GNOME Bugzilla – Bug 777547
Notebook arrow icon wrong color after closing final tab
Last modified: 2017-02-04 18:56:52 UTC
This is a follow-up to bug #770332. After closing the rightmost tab in a GtkNotebook, the tab arrow sometimes darkens to indicate that the notebook can be scrolled to the right, even though the notebook is displaying the final tab and cannot be scrolled further.
Created attachment 343930 [details] [review] notebook: redraw arrows after closing a tab
Review of attachment 343930 [details] [review]: Ok
Attachment 343930 [details] pushed as 8caaba8 - notebook: redraw arrows after closing a tab
This patch makes the widget-factory crash on close (in master at least):
+ Trace 237084
meh the last part of my message was swallowed by that trace, but one can also see that as an invalid read in valgrind: ==4809== ==4809== Invalid read of size 8 ==4809== at 0x51446BC: gtk_notebook_search_page.lto_priv.5516 (gtknotebook.c:5020) ==4809== by 0x5140585: update_arrow_state (gtknotebook.c:3294) ==4809== by 0x5143B1E: gtk_notebook_redraw_arrows.lto_priv.5514 (gtknotebook.c:4746) ==4809== by 0x514434D: gtk_notebook_real_remove (gtknotebook.c:4954) ==4809== by 0x5142443: gtk_notebook_remove.lto_priv.5295 (gtknotebook.c:4082) ==4809== by 0xA04EE8E: g_cclosure_marshal_VOID__OBJECTv (gmarshal.c:2102) ==4809== by 0xA05313D: g_type_class_meta_marshalv (gclosure.c:1024) ==4809== by 0xA052D00: _g_closure_invoke_va (gclosure.c:867) ==4809== by 0xA036DAC: g_signal_emit_valist (gsignal.c:3300) ==4809== by 0xA037F2C: g_signal_emit (gsignal.c:3447) ==4809== by 0x52AD069: gtk_container_remove (gtkcontainer.c:1693) ==4809== by 0x4FA7701: gtk_widget_dispose.lto_priv.2517 (gtkwidget.c:10358) ==4809== by 0x532C355: gtk_box_dispose (gtkbox.c:223) ==4809== by 0xA049BF2: g_object_run_dispose (gobject.c:1084) ==4809== by 0x4FEEA72: gtk_widget_destroy (gtkwidget.c:4153) ==4809== by 0x5143013: gtk_notebook_forall.lto_priv.5296 (gtknotebook.c:4430) ==4809== by 0x52AD7E6: gtk_container_foreach (gtkcontainer.c:1962) ==4809== by 0x52ACCCE: gtk_container_destroy (gtkcontainer.c:1618) ==4809== by 0x5191FCB: gtk_notebook_destroy (gtknotebook.c:1732) ==4809== by 0xA051BCA: g_cclosure_marshal_VOID(intXX_t &&) volatile (gmarshal.c:875) ==4809== by 0xA0530BC: g_type_class_meta_marshal (gclosure.c:997) ==4809== by 0xA052A68: g_closure_invoke (gclosure.c:804) ==4809== by 0xA03446D: signal_emit_unlocked_R.lto_priv.369 (gsignal.c:3751) ==4809== by 0xA0379ED: g_signal_emit_valist (gsignal.c:3391) ==4809== by 0xA037F2C: g_signal_emit (gsignal.c:3447) ==4809== by 0x4FA77A2: gtk_widget_dispose.lto_priv.2517 (gtkwidget.c:10371) ==4809== by 0xA049BF2: g_object_run_dispose (gobject.c:1084) ==4809== by 0x4FEEA72: gtk_widget_destroy (gtkwidget.c:4153) ==4809== by 0x533157F: gtk_box_forall (gtkbox.c:2500) ==4809== by 0x52AD7E6: gtk_container_foreach (gtkcontainer.c:1962) ==4809== by 0x52ACCCE: gtk_container_destroy (gtkcontainer.c:1618) ==4809== by 0xA051BCA: g_cclosure_marshal_VOID(intXX_t &&) volatile (gmarshal.c:875) ==4809== by 0xA0530BC: g_type_class_meta_marshal (gclosure.c:997) ==4809== by 0xA052A68: g_closure_invoke (gclosure.c:804) ==4809== by 0xA03446D: signal_emit_unlocked_R.lto_priv.369 (gsignal.c:3751) ==4809== by 0xA0379ED: g_signal_emit_valist (gsignal.c:3391) ==4809== by 0xA037F2C: g_signal_emit (gsignal.c:3447) ==4809== by 0x4FA77A2: gtk_widget_dispose.lto_priv.2517 (gtkwidget.c:10371) ==4809== by 0x532C355: gtk_box_dispose (gtkbox.c:223) ==4809== by 0xA049BF2: g_object_run_dispose (gobject.c:1084) ==4809== by 0x4FEEA72: gtk_widget_destroy (gtkwidget.c:4153) ==4809== by 0x533157F: gtk_box_forall (gtkbox.c:2500) ==4809== by 0x52AD7E6: gtk_container_foreach (gtkcontainer.c:1962) ==4809== by 0x52ACCCE: gtk_container_destroy (gtkcontainer.c:1618) ==4809== by 0xA051BCA: g_cclosure_marshal_VOID(intXX_t &&) volatile (gmarshal.c:875) ==4809== by 0xA0530BC: g_type_class_meta_marshal (gclosure.c:997) ==4809== by 0xA052A68: g_closure_invoke (gclosure.c:804) ==4809== by 0xA03446D: signal_emit_unlocked_R.lto_priv.369 (gsignal.c:3751) ==4809== by 0xA0379ED: g_signal_emit_valist (gsignal.c:3391) ==4809== by 0xA037F2C: g_signal_emit (gsignal.c:3447) ==4809== Address 0x19220d00 is 0 bytes inside a block of size 24 free'd ==4809== at 0x4C2BD3A: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==4809== by 0xA4E5D95: g_free (gmem.c:189) ==4809== by 0xA4CCD39: g_slice_free_chain_with_offset (gslice.c:1232) ==4809== by 0xA4F3CD2: g_list_free (glist.c:182) ==4809== by 0x514427F: gtk_notebook_real_remove (gtknotebook.c:4937) ==4809== by 0x5142443: gtk_notebook_remove.lto_priv.5295 (gtknotebook.c:4082) ==4809== by 0xA04EE8E: g_cclosure_marshal_VOID__OBJECTv (gmarshal.c:2102) ==4809== by 0xA05313D: g_type_class_meta_marshalv (gclosure.c:1024) ==4809== by 0xA052D00: _g_closure_invoke_va (gclosure.c:867) ==4809== by 0xA036DAC: g_signal_emit_valist (gsignal.c:3300) ==4809== by 0xA037F2C: g_signal_emit (gsignal.c:3447) ==4809== by 0x52AD069: gtk_container_remove (gtkcontainer.c:1693) ==4809== by 0x4FA7701: gtk_widget_dispose.lto_priv.2517 (gtkwidget.c:10358) ==4809== by 0x532C355: gtk_box_dispose (gtkbox.c:223) ==4809== by 0xA049BF2: g_object_run_dispose (gobject.c:1084) ==4809== by 0x4FEEA72: gtk_widget_destroy (gtkwidget.c:4153) ==4809== by 0x5143013: gtk_notebook_forall.lto_priv.5296 (gtknotebook.c:4430) ==4809== by 0x52AD7E6: gtk_container_foreach (gtkcontainer.c:1962) ==4809== by 0x52ACCCE: gtk_container_destroy (gtkcontainer.c:1618) ==4809== by 0x5191FCB: gtk_notebook_destroy (gtknotebook.c:1732) ==4809== by 0xA051BCA: g_cclosure_marshal_VOID(intXX_t &&) volatile (gmarshal.c:875) ==4809== by 0xA0530BC: g_type_class_meta_marshal (gclosure.c:997) ==4809== by 0xA052A68: g_closure_invoke (gclosure.c:804) ==4809== by 0xA03446D: signal_emit_unlocked_R.lto_priv.369 (gsignal.c:3751) ==4809== by 0xA0379ED: g_signal_emit_valist (gsignal.c:3391) ==4809== by 0xA037F2C: g_signal_emit (gsignal.c:3447) ==4809== by 0x4FA77A2: gtk_widget_dispose.lto_priv.2517 (gtkwidget.c:10371) ==4809== by 0xA049BF2: g_object_run_dispose (gobject.c:1084) ==4809== by 0x4FEEA72: gtk_widget_destroy (gtkwidget.c:4153) ==4809== by 0x533157F: gtk_box_forall (gtkbox.c:2500) ==4809== by 0x52AD7E6: gtk_container_foreach (gtkcontainer.c:1962) ==4809== by 0x52ACCCE: gtk_container_destroy (gtkcontainer.c:1618) ==4809== by 0xA051BCA: g_cclosure_marshal_VOID(intXX_t &&) volatile (gmarshal.c:875) ==4809== by 0xA0530BC: g_type_class_meta_marshal (gclosure.c:997) ==4809== by 0xA052A68: g_closure_invoke (gclosure.c:804) ==4809== by 0xA03446D: signal_emit_unlocked_R.lto_priv.369 (gsignal.c:3751) ==4809== by 0xA0379ED: g_signal_emit_valist (gsignal.c:3391) ==4809== by 0xA037F2C: g_signal_emit (gsignal.c:3447) ==4809== by 0x4FA77A2: gtk_widget_dispose.lto_priv.2517 (gtkwidget.c:10371) ==4809== by 0x532C355: gtk_box_dispose (gtkbox.c:223) ==4809== by 0xA049BF2: g_object_run_dispose (gobject.c:1084) ==4809== by 0x4FEEA72: gtk_widget_destroy (gtkwidget.c:4153) ==4809== by 0x533157F: gtk_box_forall (gtkbox.c:2500) ==4809== by 0x52AD7E6: gtk_container_foreach (gtkcontainer.c:1962) ==4809== by 0x52ACCCE: gtk_container_destroy (gtkcontainer.c:1618) ==4809== by 0xA051BCA: g_cclosure_marshal_VOID(intXX_t &&) volatile (gmarshal.c:875) ==4809== by 0xA0530BC: g_type_class_meta_marshal (gclosure.c:997) ==4809== by 0xA052A68: g_closure_invoke (gclosure.c:804) ==4809== by 0xA03446D: signal_emit_unlocked_R.lto_priv.369 (gsignal.c:3751) ==4809== by 0xA0379ED: g_signal_emit_valist (gsignal.c:3391) ==4809== Block was alloc'd at ==4809== at 0x4C2AB8D: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==4809== by 0xA4E5C2C: g_malloc (gmem.c:94) ==4809== by 0xA4CC8B0: g_slice_alloc (gslice.c:1025) ==4809== by 0xA4F3DBF: g_list_prepend (glist.c:311) ==4809== by 0xA4F3E78: g_list_insert (glist.c:351) ==4809== by 0x5143617: gtk_notebook_real_insert_page.lto_priv.5302 (gtknotebook.c:4621) ==4809== by 0x5147DAC: gtk_notebook_insert_page_menu (gtknotebook.c:6467) ==4809== by 0x51471DF: gtk_notebook_append_page (gtknotebook.c:6279) ==4809== by 0x5191075: gtk_notebook_buildable_add_child (gtknotebook.c:1286) ==4809== by 0x5333EE7: gtk_buildable_add_child (gtkbuildable.c:136) ==4809== by 0x53368CD: _gtk_builder_add (gtkbuilder.c:868) ==4809== by 0x52F4873: parse_custom (gtkbuilderparser.c:903) ==4809== by 0x52F4D7E: start_element.lto_priv.9740 (gtkbuilderparser.c:996) ==4809== by 0xA4EC630: emit_start_element.lto_priv.974 (gmarkup.c:1041) ==4809== by 0xA4E363B: g_markup_parse_context_parse (gmarkup.c:1388) ==4809== by 0x52F58CC: _gtk_builder_parser_parse_buffer (gtkbuilderparser.c:1274) ==4809== by 0x533750A: gtk_builder_add_from_resource (gtkbuilder.c:1230) ==4809== by 0x533A5EC: gtk_builder_new_from_resource (gtkbuilder.c:2585) ==4809== by 0x406AFA: activate.lto_priv.0 (widget-factory.c:1667) ==4809== by 0xA051BCA: g_cclosure_marshal_VOID(intXX_t &&) volatile (gmarshal.c:875) ==4809== by 0xA052A68: g_closure_invoke (gclosure.c:804) ==4809== by 0xA033FCB: signal_emit_unlocked_R.lto_priv.369 (gsignal.c:3635) ==4809== by 0xA0379ED: g_signal_emit_valist (gsignal.c:3391) ==4809== by 0xA037F2C: g_signal_emit (gsignal.c:3447) ==4809== by 0x94D254B: g_application_activate (gapplication.c:2148) ==4809== by 0x94E0683: g_application_real_local_command_line.lto_priv.1719 (gapplication.c:1045) ==4809== by 0x535AFE7: gtk_application_local_command_line.lto_priv.8507 (gtkapplication.c:330) ==4809== by 0x94D28DB: g_application_run (gapplication.c:2350) ==4809== by 0x4068CD: main (widget-factory.c:1956)
(In reply to Timm Bäder from comment #4) > This patch makes the widget-factory crash on close (in master at least): I can't reproduce; it works for me. Are you doing something special before closing widget-factory? I guess we should not redraw the arrows if the notebook is being destroyed. Not sure the right way to detect that....
(In reply to Michael Catanzaro from comment #6) > (In reply to Timm Bäder from comment #4) > > This patch makes the widget-factory crash on close (in master at least): > > I can't reproduce; it works for me. Are you doing something special before > closing widget-factory? It happens after the window already disappears and not always, it's just an invalid read. valgrind always shows it though.
(In reply to Michael Catanzaro from comment #6) > I guess we should not redraw the arrows if the notebook is being destroyed. > Not sure the right way to detect that.... gtk_notebook_real_remove() already does several things conditional on a gboolean for whether the widget is bring destroyed, so it seems the quick fix would be to use that. I dunno whether the fact it already does that is a good thing, though!
I didn't know about gtk_widget_in_destruction()! That looks useful.
I can't reproduce the valgrind warnings even in master, but I guess this patch would fix it. Timm, does it look OK to commit?
Created attachment 344663 [details] [review] notebook: redraw arrows after closing a tab Thanks to Daniel Boles for helping with a crash in an earlier version of this patch.
> Timm, does it look OK to commit? I didn't check that it fixes the actual bug, but it doesn't make the widget-factory crash anymore and valgrind doesn't complain so yes. Thanks!
Attachment 344663 [details] pushed as 644c2d9 - notebook: redraw arrows after closing a tab