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 740117 - critical error on close
critical error on close
Status: RESOLVED FIXED
Product: gitg
Classification: Applications
Component: gitg
3.14.x
Other Linux
: Normal normal
: ---
Assigned To: gitg-maint
gitg-maint
Depends on:
Blocks:
 
 
Reported: 2014-11-14 13:05 UTC by Ondrej Holy
Modified: 2014-11-14 15:31 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
window: fix warning when unbinding property (911 bytes, patch)
2014-11-14 15:04 UTC, Ignacio Casal Quinteiro (nacho)
committed Details | Review

Description Ondrej Holy 2014-11-14 13:05:16 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));
  • #0 g_logv
    at gmessages.c line 1046
  • #1 g_log
    at gmessages.c line 1079
  • #2 gitg_window_on_current_activity_changed
    at /home/jesse/git/gnome/gitg/gitg/gitg-window.vala line 545
  • #6 <emit signal notify:current on instance 0xa76720 [GitgUIElements]>
    at gsignal.c line 3365
  • #7 g_object_dispatch_properties_changed
    at gobject.c line 1056
  • #8 g_object_notify
    at gobject.c line 1149
  • #9 g_object_notify
    at gobject.c line 1197
  • #10 gitg_ui_elements_set_current_impl
    at /home/jesse/git/gnome/gitg/gitg/gitg-ui-elements.vala line 142
  • #11 _gitg_ui_elements_on_visible_child_changed_g_object_notify
    at /home/jesse/git/gnome/gitg/gitg/gitg-ui-elements.vala line 279
  • #12 _gitg_ui_elements_on_visible_child_changed_g_object_notify
    at /home/jesse/git/gnome/gitg/gitg/gitg-ui-elements.vala line 312
  • #16 <emit signal notify:visible-child on instance 0x9a4bd0 [GtkStack]>
    at gsignal.c line 3365
  • #17 g_object_dispatch_properties_changed
    at gobject.c line 1056
  • #18 g_object_notify_by_pspec
    at gobject.c line 1149
  • #19 g_object_notify_by_pspec
    at gobject.c line 1259
  • #20 set_visible_child
    at gtkstack.c line 1032
  • #21 gtk_stack_remove
    at gtkstack.c line 1186
  • #22 g_cclosure_marshal_VOID__OBJECTv
    at gmarshal.c line 1312
  • #23 _g_closure_invoke_va
    at gclosure.c line 831
  • #24 g_signal_emit_valist
    at gsignal.c line 3218
  • #25 g_signal_emit
    at gsignal.c line 3365
  • #26 gtk_container_remove
    at gtkcontainer.c line 1615
  • #27 gtk_widget_dispose
    at gtkwidget.c line 11913
  • #28 g_object_run_dispose
    at gobject.c line 1076
  • #29 gtk_stack_forall
    at gtkstack.c line 1589
  • #30 gtk_container_destroy
    at gtkcontainer.c line 1409
  • #34 <emit signal ??? on instance 0x9a4bd0 [GtkStack]>
    at gsignal.c line 3365
  • #35 gtk_widget_dispose
    at gtkwidget.c line 11924
  • #36 g_object_run_dispose
    at gobject.c line 1076
  • #37 gtk_stack_forall
    at gtkstack.c line 1589
  • #38 gtk_container_destroy
    at gtkcontainer.c line 1409
  • #42 <emit signal ??? on instance 0x9a4a20 [GtkStack]>
    at gsignal.c line 3365
  • #43 gtk_widget_dispose
    at gtkwidget.c line 11924
  • #44 g_object_run_dispose
    at gobject.c line 1076
  • #45 gtk_grid_forall
    at gtkgrid.c line 552
  • #46 gtk_container_destroy
    at gtkcontainer.c line 1409
  • #50 <emit signal ??? on instance 0x7ee900 [GtkGrid]>
    at gsignal.c line 3365
  • #51 gtk_widget_dispose
    at gtkwidget.c line 11924
  • #52 g_object_run_dispose
    at gobject.c line 1076
  • #53 gtk_window_forall
    at gtkwindow.c line 7936
  • #54 gtk_container_destroy
    at gtkcontainer.c line 1409
  • #58 <emit signal ??? on instance 0x99a3c0 [GitgWindow]>
    at gsignal.c line 3365
  • #59 gtk_widget_dispose
    at gtkwidget.c line 11924
  • #60 gtk_window_dispose
    at gtkwindow.c line 2946
  • #61 gtk_application_window_dispose
    at gtkapplicationwindow.c line 775
  • #62 g_object_run_dispose
    at gobject.c line 1076
  • #63 gtk_widget_destroy
    at gtkwidget.c line 4785
  • #64 gtk_main_do_event
    at gtkmain.c line 1646
  • #65 send_delete_event
    at gtkwindow.c line 1313
  • #66 gdk_threads_dispatch
    at gdk.c line 654
  • #67 g_main_context_dispatch
    at gmain.c line 3111
  • #68 g_main_context_dispatch
    at gmain.c line 3710
  • #69 g_main_context_iterate
    at gmain.c line 3781
  • #70 g_main_context_iteration
    at gmain.c line 3842
  • #71 g_application_run
    at gapplication.c line 2282
  • #72 gitg_main_main
    at /home/jesse/git/gnome/gitg/gitg/gitg.vala line 77
  • #73 __libc_start_main
    at libc-start.c line 289
  • #74 _start

Comment 1 Ignacio Casal Quinteiro (nacho) 2014-11-14 15:01:59 UTC
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.
Comment 2 Ignacio Casal Quinteiro (nacho) 2014-11-14 15:04:16 UTC
Created attachment 290715 [details] [review]
window: fix warning when unbinding property
Comment 3 Ignacio Casal Quinteiro (nacho) 2014-11-14 15:05:14 UTC
Attachment 290715 [details] pushed as 43c16c8 - window: fix warning when unbinding property
Comment 4 jessevdk@gmail.com 2014-11-14 15:12:53 UTC
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.
Comment 5 Luca Bruno 2014-11-14 15:31:48 UTC
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.