GNOME Bugzilla – Bug 659118
empathy frequently crashes because of already unref'fed window
Last modified: 2011-09-20 22:35:35 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
+ Trace 228449
(gdb) p *window $1 = {parent_instance = {g_type_instance = {g_class = 0x825f128}, ref_count = 0, qdata = 0xaaaaaaaa}, priv = 0xaaaaaaaa}
All that's required for me to reproduce it is to click the [x] on the Empathy main-window and wait.
Looks like something is stealing a ref on the EmpathyMainWindow. Can you do some debugging and see when it's destroyed?
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.
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.
(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.
so, yeah, +1 for the patch :)
Approved by the RT; go go merge!
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.