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 788614 - Trying to reuse a TreeViewColumn causes criticals and a segfault (e.g. testtreecolumns)
Trying to reuse a TreeViewColumn causes criticals and a segfault (e.g. testtr...
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: GtkTreeView
3.22.x
Other Linux
: Normal normal
: ---
Assigned To: gtktreeview-bugs
gtktreeview-bugs
Depends on:
Blocks:
 
 
Reported: 2017-10-06 19:03 UTC by Daniel Boles
Modified: 2017-10-06 23:48 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
TreeViewCol: Don’t try to disconnect null treeview (1.54 KB, patch)
2017-10-06 19:42 UTC, Daniel Boles
committed Details | Review
TreeViewCol: Don’t null button in unset_tree_view (1.19 KB, patch)
2017-10-06 19:43 UTC, Daniel Boles
none Details | Review
TreeViewCol: Fix SEGV on remove/add, + memory leak (1.16 KB, patch)
2017-10-06 23:43 UTC, Daniel Boles
committed Details | Review

Description Daniel Boles 2017-10-06 19:03:40 UTC
• Run tests/testtreecolumns
• Add a new column
• Click W to put it in a window
• Click Q to remove it from that window
• Click W again in an attempt to put it back
• SEGV

Also, note that ATK is not happy at the start, either. But it doesn't crash.


Gtk-Message: Failed to load module "canberra-gtk-module"
Gtk-Message: Failed to load module "canberra-gtk-module"

(testtreecolumns:20887): Gtk-CRITICAL **: file /home/daniel/jhbuild/checkout/gnome/gtk+-3/gtk/a11y/gtktreeviewaccessible.c: line 295 (get_visible_column): should not be reached

Program received signal SIGTRAP, Trace/breakpoint trap.
_g_log_abort (breakpoint=1) at /home/daniel/jhbuild/checkout/gnome/glib/glib/gmessages.c:554
554	}
(ins)(gdb) cont
Continuing.

(testtreecolumns:20887): Gtk-CRITICAL **: file /home/daniel/jhbuild/checkout/gnome/gtk+-3/gtk/a11y/gtktreeviewaccessible.c: line 295 (get_visible_column): should not be reached

Program received signal SIGTRAP, Trace/breakpoint trap.
_g_log_abort (breakpoint=1) at /home/daniel/jhbuild/checkout/gnome/glib/glib/gmessages.c:554
554	}
(ins)(gdb) cont
Continuing.
[New Thread 0x7fbb820d9700 (LWP 20892)]
[New Thread 0x7fbb818d8700 (LWP 20893)]

(testtreecolumns:20887): Gtk-WARNING **: Could not load a pixbuf from /org/gtk/libgtk/theme/Adwaita/assets/check-symbolic.svg.
This may indicate that pixbuf loaders or the mime database could not be found.

(testtreecolumns:20887): Gtk-CRITICAL **: gtk_widget_set_parent_window: assertion 'GTK_IS_WIDGET (widget)' failed

Thread 1 "testtreecolumns" received signal SIGTRAP, Trace/breakpoint trap.
_g_log_abort (breakpoint=1) at /home/daniel/jhbuild/checkout/gnome/glib/glib/gmessages.c:554
554	}
(ins)(gdb) bt
  • #0 _g_log_abort
    at /home/daniel/jhbuild/checkout/gnome/glib/glib/gmessages.c line 554
  • #1 g_logv
    at /home/daniel/jhbuild/checkout/gnome/glib/glib/gmessages.c line 1362
  • #2 g_log
    at /home/daniel/jhbuild/checkout/gnome/glib/glib/gmessages.c line 1403
  • #3 g_return_if_fail_warning
  • #4 gtk_widget_set_parent_window
    at /home/daniel/jhbuild/checkout/gnome/gtk+-3/gtk/gtkwidget.c line 10627
  • #5 _gtk_tree_view_column_set_tree_view
    at /home/daniel/jhbuild/checkout/gnome/gtk+-3/gtk/gtktreeviewcolumn.c line 1397
  • #6 gtk_tree_view_insert_column
    at /home/daniel/jhbuild/checkout/gnome/gtk+-3/gtk/gtktreeview.c line 12159
  • #7 move_to_right
    at /home/daniel/jhbuild/checkout/gnome/gtk+-3/tests/testtreecolumns.c line 619
  • #8 add_right_clicked
    at /home/daniel/jhbuild/checkout/gnome/gtk+-3/tests/testtreecolumns.c line 694
  • #9 g_cclosure_marshal_VOID__VOIDv
    at /home/daniel/jhbuild/checkout/gnome/glib/gobject/gmarshal.c line 905
  • #10 _g_closure_invoke_va
    at /home/daniel/jhbuild/checkout/gnome/glib/gobject/gclosure.c line 867
  • #11 g_signal_emit_valist
    at /home/daniel/jhbuild/checkout/gnome/glib/gobject/gsignal.c line 3300
  • #12 g_signal_emit
    at /home/daniel/jhbuild/checkout/gnome/glib/gobject/gsignal.c line 3447
  • #13 gtk_button_clicked
    at /home/daniel/jhbuild/checkout/gnome/gtk+-3/gtk/gtkbutton.c line 1539
  • #14 gtk_button_do_release
    at /home/daniel/jhbuild/checkout/gnome/gtk+-3/gtk/gtkbutton.c line 1843
  • #15 gtk_real_button_released
    at /home/daniel/jhbuild/checkout/gnome/gtk+-3/gtk/gtkbutton.c line 1961
  • #16 g_cclosure_marshal_VOID__VOIDv
    at /home/daniel/jhbuild/checkout/gnome/glib/gobject/gmarshal.c line 905
  • #17 g_type_class_meta_marshalv
    at /home/daniel/jhbuild/checkout/gnome/glib/gobject/gclosure.c line 1024
  • #18 _g_closure_invoke_va
    at /home/daniel/jhbuild/checkout/gnome/glib/gobject/gclosure.c line 867
  • #19 g_signal_emit_valist
    at /home/daniel/jhbuild/checkout/gnome/glib/gobject/gsignal.c line 3300
  • #20 g_signal_emit
    at /home/daniel/jhbuild/checkout/gnome/glib/gobject/gsignal.c line 3447
  • #21 multipress_released_cb
    at /home/daniel/jhbuild/checkout/gnome/gtk+-3/gtk/gtkbutton.c line 666
  • #22 ffi_call_unix64
    from /usr/lib/x86_64-linux-gnu/libffi.so.6
  • #23 ffi_call
    from /usr/lib/x86_64-linux-gnu/libffi.so.6
  • #24 g_cclosure_marshal_generic_va
    at /home/daniel/jhbuild/checkout/gnome/glib/gobject/gclosure.c line 1604
  • #25 _g_closure_invoke_va
    at /home/daniel/jhbuild/checkout/gnome/glib/gobject/gclosure.c line 867
  • #26 g_signal_emit_valist
    at /home/daniel/jhbuild/checkout/gnome/glib/gobject/gsignal.c line 3300
  • #27 g_signal_emit
    at /home/daniel/jhbuild/checkout/gnome/glib/gobject/gsignal.c line 3447
  • #28 gtk_gesture_multi_press_end
    at /home/daniel/jhbuild/checkout/gnome/gtk+-3/gtk/gtkgesturemultipress.c line 282
  • #29 g_cclosure_marshal_VOID__BOXEDv
    at /home/daniel/jhbuild/checkout/gnome/glib/gobject/gmarshal.c line 1950
  • #30 g_type_class_meta_marshalv
    at /home/daniel/jhbuild/checkout/gnome/glib/gobject/gclosure.c line 1024
  • #31 _g_closure_invoke_va
    at /home/daniel/jhbuild/checkout/gnome/glib/gobject/gclosure.c line 867
  • #32 g_signal_emit_valist
    at /home/daniel/jhbuild/checkout/gnome/glib/gobject/gsignal.c line 3300
  • #33 g_signal_emit
    at /home/daniel/jhbuild/checkout/gnome/glib/gobject/gsignal.c line 3447
  • #34 _gtk_gesture_set_recognized
    at /home/daniel/jhbuild/checkout/gnome/gtk+-3/gtk/gtkgesture.c line 345
  • #35 _gtk_gesture_check_recognized
    at /home/daniel/jhbuild/checkout/gnome/gtk+-3/gtk/gtkgesture.c line 386
  • #36 gtk_gesture_handle_event
    at /home/daniel/jhbuild/checkout/gnome/gtk+-3/gtk/gtkgesture.c line 777
  • #37 gtk_gesture_single_handle_event
    at /home/daniel/jhbuild/checkout/gnome/gtk+-3/gtk/gtkgesturesingle.c line 222
  • #38 gtk_event_controller_handle_event
    at /home/daniel/jhbuild/checkout/gnome/gtk+-3/gtk/gtkeventcontroller.c line 230
  • #39 _gtk_widget_run_controllers
    at /home/daniel/jhbuild/checkout/gnome/gtk+-3/gtk/gtkwidget.c line 7358
  • #40 gtk_widget_real_button_event
    at /home/daniel/jhbuild/checkout/gnome/gtk+-3/gtk/gtkwidget.c line 7133
  • #41 _gtk_marshal_BOOLEAN__BOXEDv
    at gtkmarshalers.c line 128
  • #42 g_type_class_meta_marshalv
    at /home/daniel/jhbuild/checkout/gnome/glib/gobject/gclosure.c line 1024
  • #43 _g_closure_invoke_va
    at /home/daniel/jhbuild/checkout/gnome/glib/gobject/gclosure.c line 867
  • #44 g_signal_emit_valist
    at /home/daniel/jhbuild/checkout/gnome/glib/gobject/gsignal.c line 3300
  • #45 g_signal_emit
    at /home/daniel/jhbuild/checkout/gnome/glib/gobject/gsignal.c line 3447
  • #46 gtk_widget_event_internal
    at /home/daniel/jhbuild/checkout/gnome/gtk+-3/gtk/gtkwidget.c line 7723
  • #47 gtk_widget_event
    at /home/daniel/jhbuild/checkout/gnome/gtk+-3/gtk/gtkwidget.c line 7293
  • #48 propagate_event_up
    at /home/daniel/jhbuild/checkout/gnome/gtk+-3/gtk/gtkmain.c line 2578
  • #49 propagate_event
    at /home/daniel/jhbuild/checkout/gnome/gtk+-3/gtk/gtkmain.c line 2680
  • #50 gtk_propagate_event
    at /home/daniel/jhbuild/checkout/gnome/gtk+-3/gtk/gtkmain.c line 2715
  • #51 gtk_main_do_event
    at /home/daniel/jhbuild/checkout/gnome/gtk+-3/gtk/gtkmain.c line 1911
  • #52 _gdk_event_emit
    at /home/daniel/jhbuild/checkout/gnome/gtk+-3/gdk/gdkevents.c line 73
  • #53 gdk_event_source_dispatch
    at /home/daniel/jhbuild/checkout/gnome/gtk+-3/gdk/x11/gdkeventsource.c line 367
  • #54 g_main_dispatch
    at /home/daniel/jhbuild/checkout/gnome/glib/glib/gmain.c line 3148
  • #55 g_main_context_dispatch
    at /home/daniel/jhbuild/checkout/gnome/glib/glib/gmain.c line 3813
  • #56 g_main_context_iterate
    at /home/daniel/jhbuild/checkout/gnome/glib/glib/gmain.c line 3886
  • #57 g_main_loop_run
    at /home/daniel/jhbuild/checkout/gnome/glib/glib/gmain.c line 4082
  • #58 gtk_main
    at /home/daniel/jhbuild/checkout/gnome/gtk+-3/gtk/gtkmain.c line 1322
  • #59 main
    at /home/daniel/jhbuild/checkout/gnome/gtk+-3/tests/testtreecolumns.c line 908

Comment 1 Daniel Boles 2017-10-06 19:16:22 UTC
but see https://git.gnome.org/browse/gtk+/commit/?id=2c28c627c1527d4ee2dfc4d3805f7afc482049e2 which aimed to fix the leak reported in https://bugzilla.gnome.org/show_bug.cgi?id=728452 (and presumably did, but broke this in turn)
Comment 2 Daniel Boles 2017-10-06 19:42:38 UTC
Created attachment 361063 [details] [review]
TreeViewCol: Don’t try to disconnect null treeview
Comment 3 Daniel Boles 2017-10-06 19:43:24 UTC
Created attachment 361064 [details] [review]
TreeViewCol: Don’t null button in unset_tree_view

This is asymmetrical: we create the button only via init(), not in
_set_tree_view(), so we should not unref it in the latter. Worse, this
manifests easily with basic usage of testtreecolumns.

compare Commit 2c28c627c1527d4ee2dfc4d3805f7afc482049e2 in master,
which aimed to fix the leak reported in Bug 728452 – and presumably did,
but broke this in turn. So, it’s back to the drawing board for that bug.
Comment 4 Daniel Boles 2017-10-06 23:43:20 UTC
Created attachment 361069 [details] [review]
TreeViewCol: Fix SEGV on remove/add, + memory leak

Nulling priv->button in _unset_tree_view() is asymmetrical: we create
it via init(), not _set_tree_view(), so we shouldn’t null in the latter.

Worse, doing so manifests in criticals + a SEGV easily with basic use of
testtreecolumns, removing the TVC from a TV then trying to add it to one

Finally, the wrong null-out meant dispose() failed to unref the button,
so it leaked.

https://bugzilla.gnome.org/show_bug.cgi?id=728452


--

updated the message to reflect that this seems to fix the problem outlined in
Bug 728452, i.e. column buttons not being disposed on quitting testtreeview.
testtreecolumns does not seem to fare so well, but that might just be it blazing
straight into gtk_main_quit() without properly destroying everything on the way.