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 766323 - GTKPopover gives warnings if visible when reparented
GTKPopover gives warnings if visible when reparented
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: GtkPopover
3.20.x
Other Linux
: Normal minor
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2016-05-12 13:03 UTC by Gerald Nunn
Modified: 2016-08-05 13:14 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
popver: Check for priv->window before using it (1.94 KB, patch)
2016-05-13 15:58 UTC, Timm Bäder
reviewed Details | Review
popover: set priv->window before setting doing add_popover() on it (1.50 KB, patch)
2016-05-21 18:40 UTC, Carlos Garnacho
committed Details | Review

Description Gerald Nunn 2016-05-12 13:03:34 UTC
In my application Terminix I use a popover with buttons on it to allow users to split the terminal. This causes Terminix to remove the existing terminal, drop down a GTKPaned and then re-parent the terminal to the GTKPaned plus add a new terminal.

When triggered from a popover, the following error messages are generated:

(terminix:4015): Gtk-CRITICAL **: gtk_window_get_default_widget: assertion 'GTK_IS_WINDOW (window)' failed

(terminix:4015): Gtk-CRITICAL **: gtk_window_set_default: assertion 'GTK_IS_WINDOW (window)' failed

Looking at the source code in gtkpopover, I can see that these methods are called in the popover unmap/map events. I realize my situation is an edge case, but should this code explicitly check the validity of the window before calling gtk_window_get_default_widget and gtk_window_set_default?
Comment 1 Gerald Nunn 2016-05-12 13:21:18 UTC
Also, any tips to workaround this message? While it's not critical, I'm working towards getting my app to a stable 1.0 release next week and I would love to get it running clean, this is the only GTK message I have left to resolve.

So far I have tried:

a. Hiding the popover

b. Hiding the popover and processing messages via Main.eventsPending>Main.iterationDo

c. Hiding the popover and deferring executing the action via an addIdle

No success with any of these.
Comment 2 Timm Bäder 2016-05-13 15:58:57 UTC
Created attachment 327802 [details] [review]
popver: Check for priv->window before using it


It gets possibly set to NULL in a few places, so check for it before trying to use it, like the rest of the code does.
Comment 3 Carlos Garnacho 2016-05-21 17:20:49 UTC
To the reporter, it'd be great if you could attach a backtrace with debugging symbols of that first warning (e.g. running with G_DEBUG=fatal-criticals). Those are code paths I don't expect at all while the popover is unparented.
Comment 4 Carlos Garnacho 2016-05-21 17:25:37 UTC
Comment on attachment 327802 [details] [review]
popver: Check for priv->window before using it

The patch looks alright to me as a paranoia check (Perhaps could clear too the prev_default when priv->window gets NULL in _gtk_popover_parent_hierarchy_changed()). However seems to be addressing the symptom, I'll wait to have more info before marking it a-c-n.
Comment 5 Carlos Garnacho 2016-05-21 17:25:51 UTC
Comment on attachment 327802 [details] [review]
popver: Check for priv->window before using it

The patch looks alright to me as a paranoia check (Perhaps could clear too the prev_default when priv->window gets NULL in _gtk_popover_parent_hierarchy_changed()). However seems to be addressing the symptom, I'll wait to have more info before marking it a-c-n.
Comment 6 Gerald Nunn 2016-05-21 18:01:59 UTC
As requested:

(terminix:6122): Gtk-CRITICAL **: gtk_window_get_default_widget: assertion 'GTK_IS_WINDOW (window)' failed

Thread 1 "terminix" received signal SIGTRAP, Trace/breakpoint trap.
0x00007ffff6c3670b in g_logv () from /usr/lib/libglib-2.0.so.0
(gdb) bt
  • #0 g_logv
    from /usr/lib/libglib-2.0.so.0
  • #1 g_log
    from /usr/lib/libglib-2.0.so.0
  • #2 gtk_window_get_default_widget
    at gtkwindow.c line 2690
  • #3 gtk_popover_map
    at gtkpopover.c line 624
  • #4 g_closure_invoke
    from /usr/lib/libgobject-2.0.so.0
  • #5 ??
    from /usr/lib/libgobject-2.0.so.0
  • #6 g_signal_emit_valist
    from /usr/lib/libgobject-2.0.so.0
  • #7 g_signal_emit
    from /usr/lib/libgobject-2.0.so.0
  • #8 gtk_widget_map
    at gtkwidget.c line 4982
  • #9 gtk_widget_set_parent
    at gtkwidget.c line 9535
  • #10 _gtk_window_add_popover
    at gtkwindow.c line 12216
  • #11 _gtk_popover_parent_hierarchy_changed
    at gtkpopover.c line 1778
  • #12 g_cclosure_marshal_VOID__OBJECTv
    from /usr/lib/libgobject-2.0.so.0
  • #13 ??
    from /usr/lib/libgobject-2.0.so.0
  • #14 g_signal_emit_valist
    from /usr/lib/libgobject-2.0.so.0
  • #15 g_signal_emit
    from /usr/lib/libgobject-2.0.so.0
  • #16 gtk_widget_propagate_hierarchy_changed_recurse
    at gtkwidget.c line 9864
  • #17 gtk_box_forall
    at gtkbox.c line 2661
  • #18 gtk_widget_propagate_hierarchy_changed_recurse
    at gtkwidget.c line 9868
  • #19 gtk_widget_propagate_hierarchy_changed_recurse
    at gtkwidget.c line 9868
  • #20 gtk_box_forall
    at gtkbox.c line 2661
  • #21 gtk_widget_propagate_hierarchy_changed_recurse
    at gtkwidget.c line 9868
  • #22 gtk_widget_propagate_hierarchy_changed_recurse
    at gtkwidget.c line 9868
  • #23 gtk_box_forall
    at gtkbox.c line 2661
  • #24 gtk_widget_propagate_hierarchy_changed_recurse
    at gtkwidget.c line 9868
  • #25 gtk_paned_forall
    at gtkpaned.c line 2324
  • #26 gtk_widget_propagate_hierarchy_changed_recurse
    at gtkwidget.c line 9868
  • #27 _gtk_widget_propagate_hierarchy_changed
    at gtkwidget.c line 9906
  • #28 gtk_widget_set_parent
    at gtkwidget.c line 9522
  • #29 gtk_box_pack
    at gtkbox.c line 1543
  • #30 g_cclosure_marshal_VOID__OBJECTv
    from /usr/lib/libgobject-2.0.so.0
  • #31 ??
    from /usr/lib/libgobject-2.0.so.0
  • #32 g_signal_emit_valist
    from /usr/lib/libgobject-2.0.so.0
  • #33 g_signal_emit
    from /usr/lib/libgobject-2.0.so.0
  • #34 gtk_container_add
    at gtkcontainer.c line 1875
  • #35 gtk.Container.Container.add(gtk.Widget.Widget)
    at ../../../.dub/packages/gtk-d-3.3.1/src/gtk/Container.d line 320
  • #36 gx.terminix.session.Session.insertTerminal(gx.terminix.terminal.terminal.Terminal, gx.terminix.terminal.terminal.Terminal, gtkc.gtktypes.GtkOrientation, int)
    at source/gx/terminix/session.d line 486
  • #37 gx.terminix.session.Session.onTerminalRequestSplit(gx.terminix.terminal.terminal.Terminal, gtkc.gtktypes.GtkOrientation)
    at source/gx/terminix/session.d line 371
  • #38 gx.terminix.terminal.terminal.Terminal.notifyTerminalRequestSplit(gtkc.gtktypes.GtkOrientation)
    at source/gx/terminix/terminal/terminal.d line 906
  • #39 gx.terminix.terminal.terminal.Terminal.createActions(gio.SimpleActionGroup.SimpleActionGroup).__dgliteral2!(glib.Variant.Variant, gio.SimpleAction.SimpleAction).__dgliteral2(glib.Variant.Variant, gio.SimpleAction.SimpleAction)
    at source/gx/terminix/terminal/terminal.d line 439
  • #40 gio.SimpleAction.SimpleAction.callBackActivate(gtkc.giotypes.GSimpleAction*, gtkc.glibtypes.GVariant*, gio.SimpleAction.SimpleAction)
    at ../../../.dub/packages/gtk-d-3.3.1/src/gio/SimpleAction.d line 243
  • #41 g_closure_invoke
    from /usr/lib/libgobject-2.0.so.0
  • #42 ??
    from /usr/lib/libgobject-2.0.so.0
  • #43 g_signal_emit_valist
    from /usr/lib/libgobject-2.0.so.0
  • #44 g_signal_emit
    from /usr/lib/libgobject-2.0.so.0
  • #45 ??
    from /usr/lib/libgio-2.0.so.0
  • #46 gtk_action_muxer_activate_action
    at gtkactionmuxer.c line 412
  • #47 gtk_action_muxer_activate_action
    at gtkactionmuxer.c line 414
  • #48 gtk_action_muxer_activate_action
    at gtkactionmuxer.c line 414
  • #49 gtk_action_muxer_activate_action
    at gtkactionmuxer.c line 414
  • #50 gtk_action_muxer_activate_action
    at gtkactionmuxer.c line 414
  • #51 gtk_action_muxer_activate_action
    at gtkactionmuxer.c line 414
  • #52 gtk_action_muxer_activate_action
    at gtkactionmuxer.c line 414
  • #53 gtk_action_muxer_activate_action
    at gtkactionmuxer.c line 414
  • #54 gtk_menu_tracker_item_activated
    at gtkmenutrackeritem.c line 789
  • #55 gtk_popover_item_activate
    at gtkmenusectionbox.c line 184
  • #56 g_closure_invoke
    from /usr/lib/libgobject-2.0.so.0
  • #57 ??
    from /usr/lib/libgobject-2.0.so.0
  • #58 g_signal_emit_valist
    from /usr/lib/libgobject-2.0.so.0
  • #59 g_signal_emit
    from /usr/lib/libgobject-2.0.so.0
  • #60 gtk_button_do_release
    at gtkbutton.c line 1843
  • #61 gtk_real_button_released
    at gtkbutton.c line 1961
  • #62 ??
    from /usr/lib/libgobject-2.0.so.0
  • #63 g_signal_emit_valist
    from /usr/lib/libgobject-2.0.so.0
  • #64 g_signal_emit
    from /usr/lib/libgobject-2.0.so.0
  • #65 multipress_released_cb
    at gtkbutton.c line 666
  • #66 ffi_call_unix64
    from /usr/lib/libffi.so.6
  • #67 ffi_call
    from /usr/lib/libffi.so.6
  • #68 g_cclosure_marshal_generic_va
    from /usr/lib/libgobject-2.0.so.0
  • #69 ??
    from /usr/lib/libgobject-2.0.so.0
  • #70 g_signal_emit_valist
    from /usr/lib/libgobject-2.0.so.0
  • #71 g_signal_emit
    from /usr/lib/libgobject-2.0.so.0
  • #72 gtk_gesture_multi_press_end
    at gtkgesturemultipress.c line 282
  • #73 g_cclosure_marshal_VOID__BOXEDv
    from /usr/lib/libgobject-2.0.so.0
  • #74 ??
    from /usr/lib/libgobject-2.0.so.0
  • #75 g_signal_emit_valist
    from /usr/lib/libgobject-2.0.so.0
  • #76 g_signal_emit
    from /usr/lib/libgobject-2.0.so.0
  • #77 _gtk_gesture_set_recognized
    at gtkgesture.c line 345
  • #78 _gtk_gesture_check_recognized
    at gtkgesture.c line 386
  • #79 gtk_gesture_handle_event
    at gtkgesture.c line 777
  • #80 gtk_gesture_single_handle_event
    at gtkgesturesingle.c line 221
  • #81 gtk_event_controller_handle_event
    at gtkeventcontroller.c line 230
  • #82 _gtk_widget_run_controllers
    at gtkwidget.c line 7328
  • #83 _gtk_marshal_BOOLEAN__BOXEDv
    at gtkmarshalers.c line 131
  • #84 ??
    from /usr/lib/libgobject-2.0.so.0
  • #85 g_signal_emit_valist
    from /usr/lib/libgobject-2.0.so.0
  • #86 g_signal_emit
    from /usr/lib/libgobject-2.0.so.0
  • #87 gtk_widget_event_internal
    at gtkwidget.c line 7703
  • #88 propagate_event_up
    at gtkmain.c line 2545
  • #89 propagate_event
    at gtkmain.c line 2647
  • #90 gtk_main_do_event
    at gtkmain.c line 1878
  • #91 _gdk_event_emit
    at gdkevents.c line 73
  • #92 gdk_event_source_dispatch
    at gdkeventsource.c line 367
  • #93 g_main_context_dispatch
    from /usr/lib/libglib-2.0.so.0
  • #94 ??
    from /usr/lib/libglib-2.0.so.0
  • #95 g_main_context_iteration
    from /usr/lib/libglib-2.0.so.0
  • #96 g_application_run
    from /usr/lib/libgio-2.0.so.0
  • #97 gio.Application.Application.run(immutable(char)[][])
    at ../../../.dub/packages/gtk-d-3.3.1/src/gio/Application.d line 889
  • #98 D main
    at source/app.d line 91

Comment 7 Carlos Garnacho 2016-05-21 18:39:21 UTC
Thanks for the backtrace, also got a testcase kindly provided by Timm. I'm pushing a fix to master/gtk-3-20.
Comment 8 Carlos Garnacho 2016-05-21 18:40:44 UTC
The following fix has been pushed:
76a5e3f popover: set priv->window before setting doing add_popover() on it
Comment 9 Carlos Garnacho 2016-05-21 18:40:52 UTC
Created attachment 328320 [details] [review]
popover: set priv->window before setting doing add_popover() on it

If the popover's relative-to widget is unparented/reparented, we end
up unparenting/reparenting the popover as well. In that case, at the
moment of reparenting, the widget might have been visible (and is
thus mapped again), but priv->window hasn't been set yet.

We must first set priv->window, and then call gtk_window_add_popover(),
that way gtk_popover_map() has its prerequisites straight.
Comment 10 Gerald Nunn 2016-05-21 20:53:07 UTC
Thank you both for your work on this, much appreciated.
Comment 11 Carlos Soriano 2016-08-05 12:25:10 UTC
*** Bug 769547 has been marked as a duplicate of this bug. ***