Bug 3380 - clamav_plugin_gtk.c: g_type_check_instance_cast(): claws-mail killed by SIGSEGV
Summary: clamav_plugin_gtk.c: g_type_check_instance_cast(): claws-mail killed by SIGSEGV
Status: RESOLVED FIXED
Alias: None
Product: Claws Mail (GTK 2)
Classification: Unclassified
Component: Plugins/Clamd (show other bugs)
Version: 3.11.1
Hardware: PC Linux
: P3 normal
Assignee: users
URL:
Depends on:
Blocks:
 
Reported: 2015-02-04 11:48 UTC by Michael Schwendt
Modified: 2015-02-05 12:29 UTC (History)
1 user (show)

See Also:


Attachments
patch to fix bug #3380 (897 bytes, patch)
2015-02-04 17:13 UTC, Michael Rasmussen
no flags Details | Diff

Description Michael Schwendt 2015-02-04 11:48:56 UTC
Backtrace reported by two users for Fedora 21 and 20 with Claws Mail 3.11.1:
https://bugzilla.redhat.com/1188919

What I could reproduce after restarting clean and _without_ running Clamav:

1. install claws-mail-plugins-clamd
2. enable the plugin
3. open Clam AntiVirus Preferences
4. check "[x] Enable virus scanning"
5. click "OK" button

-> Error
   : Unable to open
   clamd will be disabled
 [Close]

-> Warning
  New config
  Clamd does not respond to ping.
  Is clamd running?
  [Close]

6. after closing the two Error/Warning dialogs, open Clam AntiVirus Preferences again.
7. segfault
Comment 1 Michael Rasmussen 2015-02-04 17:12:24 UTC
Hi Michael,

Since I don't have access to a Fedora installation here could I persuade you to try the proposed patch?

I compiles and runs fine here (Debian Unstable)

Michael.
Comment 2 Michael Rasmussen 2015-02-04 17:13:34 UTC
Created attachment 1476 [details]
patch to fix bug #3380
Comment 4 Michael Rasmussen 2015-02-04 19:39:04 UTC
(In reply to comment #3)
> f21 scratch build https://koji.fedoraproject.org/koji/taskinfo?taskID=8819381
> f20 scratch build https://koji.fedoraproject.org/koji/taskinfo?taskID=8819387

Does this mean the proposed patch fixes the bug?

(Sorry for my fedora project ignorance ;-)
Comment 5 Michael Schwendt 2015-02-04 22:34:38 UTC
> Does this mean the proposed patch fixes the bug?

So-called "scratch builds" are done in the official Fedora Build System, but are thrown away automatically after some time. They are not intended to be released as distribution updates. They are done to create test-builds.

> (Sorry for my fedora project ignorance ;-)

It's okay. The bug is not specific to Fedora in my opinion. You should be able to reproduce the crash with stock Claws Mail 3.11.1.

Provided that the proposed patch is applied correctly in the test-build, it doesn't fix the crash.
Comment 6 Michael Schwendt 2015-02-04 22:45:52 UTC
Currently, the steps to reproduce are even easier. I don't need to touch anything in the dialog. Just opening and closing it, then opening it once more crashes Claws Mail. "Enable Virus Scanning" can stay unchecked.
Comment 7 Michael Schwendt 2015-02-04 22:51:37 UTC
$ claws-mail --debug
[...]
[open clamd plugin preferences the first time]
[...]
prefswindow.c:706:0.000000
prefswindow.c:706:0.000000
clamd-plugin.c:259:Looking for /etc/clamd.conf
clamd-plugin.c:259:Looking for /usr/local/etc/clamd.conf
clamd-plugin.c:259:Looking for /etc/clamav/clamd.conf
clamd-plugin.c:259:Looking for /usr/local/etc/clamav/clamd.conf
clamav_plugin.c:240:Saving Clamd Page
prefs.c:310:Found [ClamAV]
prefswindow.c:706:0.000000
[...]
[close dialog with Okay or Cancel]
[open clamd plugin preferences the second time]
[...]
inc.c:1479:removed timer = 300
inc.c:1467:added timer = 677
clamav_plugin_gtk.c:503:Saving Clamd Page
clamav_plugin.c:240:Saving Clamd Page
prefs.c:310:Found [ClamAV]
prefswindow.c:177:prefs window closed
clamav_plugin_gtk.c:495:Destroying Clamd widget
prefswindow.c:706:0.000000
prefswindow.c:706:0.000000
clamav_plugin_gtk.c:163:Resetting configuration

(claws-mail:15985): GLib-GObject-WARNING **: invalid unclassed pointer in cast to 'GtkEditable'

(claws-mail:15985): Gtk-CRITICAL **: IA__gtk_editable_delete_text: assertion 'GTK_IS_EDITABLE (editable)' failed

(claws-mail:15985): GLib-GObject-WARNING **: invalid unclassed pointer in cast to 'GtkEditable'

(claws-mail:15985): Gtk-CRITICAL **: IA__gtk_editable_delete_text: assertion 'GTK_IS_EDITABLE (editable)' failed
clamav_plugin.c:240:Saving Clamd Page
prefs.c:310:Found [ClamAV]
clamav_plugin_gtk.c:176:Setting clamd to automatic configuration
clamd-plugin.c:259:Looking for /etc/clamd.conf
clamd-plugin.c:259:Looking for /usr/local/etc/clamd.conf
clamd-plugin.c:259:Looking for /etc/clamav/clamd.conf
clamd-plugin.c:259:Looking for /usr/local/etc/clamav/clamd.conf
Segmentation fault (core dumped)
Comment 8 Michael Schwendt 2015-02-04 22:55:21 UTC
Inserted comments at wrong locations. Here's the corrected one:

$ claws-mail --debug
[...]
[open clamd plugin preferences the first time]
[...]
prefswindow.c:706:0.000000
prefswindow.c:706:0.000000
clamd-plugin.c:259:Looking for /etc/clamd.conf
clamd-plugin.c:259:Looking for /usr/local/etc/clamd.conf
clamd-plugin.c:259:Looking for /etc/clamav/clamd.conf
clamd-plugin.c:259:Looking for /usr/local/etc/clamav/clamd.conf
clamav_plugin.c:240:Saving Clamd Page
prefs.c:310:Found [ClamAV]
prefswindow.c:706:0.000000
[...]
[close dialog with Okay or Cancel]
[...]
inc.c:1479:removed timer = 300
inc.c:1467:added timer = 677
clamav_plugin_gtk.c:503:Saving Clamd Page
clamav_plugin.c:240:Saving Clamd Page
prefs.c:310:Found [ClamAV]
prefswindow.c:177:prefs window closed
clamav_plugin_gtk.c:495:Destroying Clamd widget

[...]
[open clamd plugin preferences the second time]
[...]

prefswindow.c:706:0.000000
prefswindow.c:706:0.000000
clamav_plugin_gtk.c:163:Resetting configuration

(claws-mail:15985): GLib-GObject-WARNING **: invalid unclassed pointer in cast to 'GtkEditable'

(claws-mail:15985): Gtk-CRITICAL **: IA__gtk_editable_delete_text: assertion 'GTK_IS_EDITABLE (editable)' failed

(claws-mail:15985): GLib-GObject-WARNING **: invalid unclassed pointer in cast to 'GtkEditable'

(claws-mail:15985): Gtk-CRITICAL **: IA__gtk_editable_delete_text: assertion 'GTK_IS_EDITABLE (editable)' failed
clamav_plugin.c:240:Saving Clamd Page
prefs.c:310:Found [ClamAV]
clamav_plugin_gtk.c:176:Setting clamd to automatic configuration
clamd-plugin.c:259:Looking for /etc/clamd.conf
clamd-plugin.c:259:Looking for /usr/local/etc/clamd.conf
clamd-plugin.c:259:Looking for /etc/clamav/clamd.conf
clamd-plugin.c:259:Looking for /usr/local/etc/clamav/clamd.conf
Segmentation fault (core dumped)
Comment 9 users 2015-02-05 01:22:03 UTC
Changes related to this bug have been committed.
Please check latest Git and update the bug accordingly.
You can also get the patch from:
http://git.claws-mail.org/

++ ChangeLog	2015-02-05 01:22:02.719362306 +0100
http://git.claws-mail.org/?p=claws.git;a=commitdiff;h=da5018ea3bd8b10efe756f977c6069ee21eb0a90
Merge: f0e6676 87ab2b6
Author: Colin Leroy <colin@colino.net>
Date:   Thu Feb 5 01:22:02 2015 +0100

    Merge branch 'master' of file:///home/git/claws

http://git.claws-mail.org/?p=claws.git;a=commitdiff;h=87ab2b6cf05444a26509543bc7cfa52d842539be
Author: Michael Rasmussen <mir@datanom.net>
Date:   Thu Feb 5 01:21:31 2015 +0100

    Fix bug #3380. Initialize widget before callback handler for 'clicked'
Comment 10 Michael Rasmussen 2015-02-05 01:23:59 UTC
See commit 87ab2b6 which should fix the bug.
Cause for the bug was a race condition. Wait to install callback handler for 'clicked' until after setting initial state.
Comment 11 Michael Schwendt 2015-02-05 12:29:10 UTC
Confirmed fixed.

Note You need to log in before you can comment on or make changes to this bug.