After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 659118 - empathy frequently crashes because of already unref'fed window
empathy frequently crashes because of already unref'fed window
Status: RESOLVED FIXED
Product: empathy
Classification: Core
Component: General
3.1.x
Other Linux
: Normal critical
: 3.2
Assigned To: empathy-maint
empathy-maint
Depends on:
Blocks:
 
 
Reported: 2011-09-15 05:24 UTC by Danielle Madeley
Modified: 2011-09-20 22:35 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Danielle Madeley 2011-09-15 05:24:18 UTC
GLib-GObject-WARNING **: instance of invalid non-instantiatable type `<invalid>'

Program received signal SIGTRAP, Trace/breakpoint trap.
0x005d431b in g_logv (log_domain=0x5464b0 "GLib-GObject", 
    log_level=G_LOG_LEVEL_WARNING, 
    format=0x547c4c "instance of invalid non-instantiatable type `%s'", 
    args1=0xbfffe68c "\311eT") at gmessages.c:552
warning: Source file is more recent than executable.
552	                }
(gdb) bt
  • #0 g_logv
    at gmessages.c line 552
  • #1 g_log
    at gmessages.c line 573
  • #2 g_type_check_instance
    at gtype.c line 4064
  • #3 g_signal_handlers_destroy
    at gsignal.c line 2430
  • #4 g_object_real_dispose
    at gobject.c line 894
  • #5 ??
    from /usr/lib/libgtk-3.so.0
  • #6 ??
    from /usr/lib/libgtk-3.so.0
  • #7 g_object_unref
    at gobject.c line 2709
  • #8 event_manager_presence_changed_cb
    at empathy-event-manager.c line 1269
  • #8 event_manager_presence_changed_cb
    at empathy-event-manager.c line 1269


(gdb) p *window
$1 = {parent_instance = {g_type_instance = {g_class = 0x825f128}, 
    ref_count = 0, qdata = 0xaaaaaaaa}, priv = 0xaaaaaaaa}
Comment 1 Danielle Madeley 2011-09-15 08:45:22 UTC
All that's required for me to reproduce it is to click the [x] on the Empathy main-window and wait.
Comment 2 Guillaume Desmottes 2011-09-15 09:20:55 UTC
Looks like something is stealing a ref on the EmpathyMainWindow. Can you do some debugging and see when it's destroyed?
Comment 3 Danielle Madeley 2011-09-20 06:40:11 UTC
http://cgit.collabora.com/git/user/danni/empathy.git/log/?h=crash-659118

In the end, the conclusion I came to is that there's only one baseline reference to the EmpathyMainWindow, which is being held by GTK+. So long as the window is open, things seem to work fine.

Anyway, calling hide on delete-event, instead of destroying the widget causes GTK+ to maintain this reference, and things work properly again. The main-window remains in memory, but I don't think this is a big deal, as random things will dup the window from time to time even when hidden (which previously would recreate it).

Running a second empathy process causes the MainWindow to appear as expected.
Comment 4 Xavier Claessens 2011-09-20 08:13:15 UTC
Note that in empathy.c I think it should do a g_object_ref_sink() to claim being "owner" of the main window, and in empathy_app_finalize() it should do g_object_unref() instead of gtk_widget_destroy(). Otherwise the window is leaked at exit afaik.

Danielle's patch makes sense too.
Comment 5 Xavier Claessens 2011-09-20 12:40:13 UTC
(In reply to comment #4)
> Note that in empathy.c I think it should do a g_object_ref_sink() to claim
> being "owner" of the main window, and in empathy_app_finalize() it should do
> g_object_unref() instead of gtk_widget_destroy(). Otherwise the window is
> leaked at exit afaik.

Was wrong, I always forget that gtk_window_init() already does g_object_ref_sink(). So despite it being subclass of GInitiallyUnowned, it's actually initially owned by gtk.
Comment 6 Xavier Claessens 2011-09-20 12:42:52 UTC
so, yeah, +1 for the patch :)
Comment 7 Guillaume Desmottes 2011-09-20 15:04:26 UTC
Approved by the RT; go go merge!
Comment 8 Danielle Madeley 2011-09-20 22:35:35 UTC
Mergered.

This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report.