GNOME Bugzilla – Bug 740117
critical error on close
Last modified: 2014-11-14 15:31:48 UTC
Steps to reproduce: 1) run gitg from non-git directory 2) close it 3) (gitg:19610): GLib-GObject-CRITICAL **: g_object_unref: assertion 'G_IS_OBJECT (object)' failed (It is always reproducible.) Program received signal SIGTRAP, Trace/breakpoint trap. g_logv (log_domain=0x7ffff16d9164 "GLib-GObject", log_level=G_LOG_LEVEL_CRITICAL, format=<optimized out>, args=args@entry=0x7fffffffbce0) at gmessages.c:1046 1046 g_private_set (&g_log_depth, GUINT_TO_POINTER (depth));
+ Trace 234330
I had a look at the code, this is the specific part: if (d_selectable_mode_binding != null) { d_selectable_mode_binding.unbind(); d_selectable_mode_binding = null; } The reason for thsi is that when you set an object to null, vala will try to also unref the object. This could perfectly be a bug in vala, though we can just fix it by removing the unbind and let vala unref the object instead. Since when we unref the binding it will already unbind by itself.
Created attachment 290715 [details] [review] window: fix warning when unbinding property
Attachment 290715 [details] pushed as 43c16c8 - window: fix warning when unbinding property
Nice catch! Just for future reference, the reason calling unbind explicitly leads to problems is that g_binding_unbind actually does an unref. This is kind of strange I guess, and doesn't really fit GObject semantics if you'd ask me. In any case, vala isn't aware of this probably, and is going to do the wrong thing. It might be worth raising an issue for vala if there isn't already, just so they're aware of the issue. I'm not actually sure there is a good solution for it, but maybe they can wrap it and do an explicit ref before the unbind.
Committed a fix for Vala, tested by nacho. commit e9ef9b97ee54dfd0a6f4c77acbf278266757e469 Author: Luca Bruno <luca.bruno@immobiliare.it> Date: Fri Nov 14 16:30:17 2014 +0100 gobject-2.0: Add DestroysInstance to Binding.unbind() Fixes bug 740117 Also backported to Vala 0.26.