Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix GTK assertions about get and set the default widget #15

Closed
gnunn1 opened this issue Jan 13, 2016 · 7 comments
Closed

Fix GTK assertions about get and set the default widget #15

gnunn1 opened this issue Jan 13, 2016 · 7 comments
Labels

Comments

@gnunn1
Copy link
Owner

gnunn1 commented Jan 13, 2016

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

(terminix:5762): Gtk-CRITICAL **: gtk_window_set_default: assertion 'GTK_IS_WINDOW (window)' failed
@bilelmoussaoui
Copy link
Contributor

Have some Gtk assertions "bugs"

(terminix:5533): Gtk-CRITICAL **: gtk_label_set_text_with_mnemonic: assertion 'str != NULL' failed

(terminix:5533): Gtk-CRITICAL **: gtk_label_set_text_with_mnemonic: assertion 'str != NULL' failed

(terminix:5533): GLib-CRITICAL **: g_variant_get_int64: assertion 'g_variant_is_of_type (value, G_VARIANT_TYPE_INT64)' failed

@gnunn1
Copy link
Owner Author

gnunn1 commented Jan 13, 2016

Thanks, the third one about INT64 has been fixed, it was actually causing a crash on some platforms. I'm working on resolving the others and getting to the point where it runs clean.

@gnunn1
Copy link
Owner Author

gnunn1 commented Jan 17, 2016

I'm inclined to think that the gtk_window_get_default_widget and gtk_window_set_default messages a bug in GTK 3.18.6-2 as they don't happen in older version (RHEL 7.2) or newer versions (Rawhide). They don't seem to be causing any stability so closing this issue.

For information purposes, below is the stack trace when this occurs:

#0  0x00007ffff1d5e64b in g_logv () from /usr/lib/libglib-2.0.so.0
#1  0x00007ffff1d5e7bf in g_log () from /usr/lib/libglib-2.0.so.0
#2  0x00007fffeddb9f64 in gtk_window_get_default_widget () from /usr/lib/libgtk-3.so.0
#3  0x00007fffedcbc6d6 in ?? () from /usr/lib/libgtk-3.so.0
#4  0x00007ffff1224015 in g_closure_invoke () from /usr/lib/libgobject-2.0.so.0
#5  0x00007ffff1235b9c in ?? () from /usr/lib/libgobject-2.0.so.0
#6  0x00007ffff123edfc in g_signal_emit_valist () from /usr/lib/libgobject-2.0.so.0
#7  0x00007ffff123f12f in g_signal_emit () from /usr/lib/libgobject-2.0.so.0
#8  0x00007fffeddad530 in gtk_widget_map () from /usr/lib/libgtk-3.so.0
#9  0x00007fffeddb01e7 in gtk_widget_set_parent () from /usr/lib/libgtk-3.so.0
#10 0x00007fffeddc21f7 in ?? () from /usr/lib/libgtk-3.so.0
#11 0x00007fffedcbc7ad in ?? () from /usr/lib/libgtk-3.so.0
#12 0x00007ffff1227117 in g_cclosure_marshal_VOID__OBJECTv () from /usr/lib/libgobject-2.0.so.0
#13 0x00007ffff1224244 in ?? () from /usr/lib/libgobject-2.0.so.0
#14 0x00007ffff123ea46 in g_signal_emit_valist () from /usr/lib/libgobject-2.0.so.0
#15 0x00007ffff123f12f in g_signal_emit () from /usr/lib/libgobject-2.0.so.0
#16 0x00007fffedd9f439 in ?? () from /usr/lib/libgtk-3.so.0
#17 0x00007fffedb61007 in ?? () from /usr/lib/libgtk-3.so.0
#18 0x00007fffedd9f4e2 in ?? () from /usr/lib/libgtk-3.so.0
#19 0x00007fffedd9f4e2 in ?? () from /usr/lib/libgtk-3.so.0
#20 0x00007fffedb61007 in ?? () from /usr/lib/libgtk-3.so.0
#21 0x00007fffedd9f4e2 in ?? () from /usr/lib/libgtk-3.so.0
#22 0x00007fffedb61007 in ?? () from /usr/lib/libgtk-3.so.0
#23 0x00007fffedd9f4e2 in ?? () from /usr/lib/libgtk-3.so.0
#24 0x00007fffedc9c6c2 in ?? () from /usr/lib/libgtk-3.so.0
#25 0x00007fffedd9f4e2 in ?? () from /usr/lib/libgtk-3.so.0
#26 0x00007fffedda2433 in ?? () from /usr/lib/libgtk-3.so.0
#27 0x00007fffeddb01aa in gtk_widget_set_parent () from /usr/lib/libgtk-3.so.0
#28 0x00007fffedb63777 in ?? () from /usr/lib/libgtk-3.so.0
#29 0x00007ffff1227117 in g_cclosure_marshal_VOID__OBJECTv () from /usr/lib/libgobject-2.0.so.0
#30 0x00007ffff1224244 in ?? () from /usr/lib/libgobject-2.0.so.0
#31 0x00007ffff123ea46 in g_signal_emit_valist () from /usr/lib/libgobject-2.0.so.0
#32 0x00007ffff123f12f in g_signal_emit () from /usr/lib/libgobject-2.0.so.0
#33 0x00007fffedba6b95 in gtk_container_add () from /usr/lib/libgtk-3.so.0
#34 0x00000000008bb634 in gtk.Container.Container.add(gtk.Widget.Widget) (this=0x7ffff7f2e800, widget=0x7ffff7ee3800) at ../../GtkD/src/gtk/Container.d:310
#35 0x000000000083ac7a in gx.terminix.session.Session.insertTerminal(gx.terminix.terminal.terminal.Terminal, gx.terminix.terminal.terminal.Terminal, gtkc.gtktypes.GtkOrientation, int) (this=0x7ffff7f2e800, child=2, orientation=<incomplete type>, src=0x7fffdbc02000, dest=0x7fffdbc00000) at source/gx/terminix/session.d:349
#36 0x000000000083a7ad in gx.terminix.session.Session.onTerminalRequestSplit(gx.terminix.terminal.terminal.Terminal, gtkc.gtktypes.GtkOrientation) (this=0x7ffff7f2e800, 
    orientation=<incomplete type>, terminal=0x7fffdbc00000) at source/gx/terminix/session.d:245

@gnunn1
Copy link
Owner Author

gnunn1 commented May 12, 2016

This one has been bugging me for a long time and as part of the drive towards 1.0 I took another look at this. The good news is that I finally managed to track down what is causing it.

The GTKPopover calls the get and set default widget methods in map/unmap events. Normally this is not an issue, however because when you split the terminal the session unparents and then parents the terminal it causes all widgets in the terminal, including the displayed popover, to go through a unmap/map cycle causing these messages.

If you do the split through a keyboard shortcut, these error messages don't appear.

Here's the relevant code in gtkpopover.c

static void
gtk_popover_map (GtkWidget *widget)
{
  GtkPopoverPrivate *priv = GTK_POPOVER (widget)->priv;

  priv->prev_default = gtk_window_get_default_widget (priv->window);
  if (priv->prev_default)
    g_object_ref (priv->prev_default);

  GTK_WIDGET_CLASS (gtk_popover_parent_class)->map (widget);

  gdk_window_show (gtk_widget_get_window (widget));
  gtk_popover_update_position (GTK_POPOVER (widget));

  gtk_window_set_default (priv->window, priv->default_widget);
}

static void
gtk_popover_unmap (GtkWidget *widget)
{
  GtkPopoverPrivate *priv = GTK_POPOVER (widget)->priv;

  priv->button_pressed = FALSE;

  gdk_window_hide (gtk_widget_get_window (widget));
  GTK_WIDGET_CLASS (gtk_popover_parent_class)->unmap (widget);

  if (gtk_window_get_default_widget (priv->window) == priv->default_widget)
    gtk_window_set_default (priv->window, priv->prev_default);
  g_clear_object (&priv->prev_default);
}

The bad news is I haven't been able to fix it so far, I've tried explicitly hiding the popover, deferring the action via addIdle and processing events before triggering the split but no luck. However, now that I know what the issue is I'm optimistic about putting this one to rest. I'll ping the IRC channel in the morning about this as well, I'm wondering if this is a gtk+ bug in the sense that it should check if the window is available first.

@gnunn1 gnunn1 added the bug label May 12, 2016
@gnunn1
Copy link
Owner Author

gnunn1 commented May 12, 2016

Opened GTK+ bug for this:

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

@gnunn1
Copy link
Owner Author

gnunn1 commented May 16, 2016

A patch has been attached to the bug report in GTK and I don't see any way to work around it on my end so closing this as a GTK bug.

@gnunn1 gnunn1 closed this as completed May 16, 2016
@gnunn1
Copy link
Owner Author

gnunn1 commented May 24, 2016

This has been fixed in GTK 3.20.6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants