GNOME Bugzilla – Bug 761156
[Wayland] Setting a popover 'relative_to' a widget on an offscreen window crashes gtk+
Last modified: 2016-03-02 03:20:54 UTC
We are mantaining an unofficial repo of Gnome Alphas for Arch Linux. We've built the whole Gnome 3.19.4 release. When we try to launch Gnome Maps on wayland session it don't start. Here you have gdb output: http://pastebin.com/kzePYwef
Reproduced on openSUSE Tumbleweed - with GNOME Maps 3.19.90
I noticed this too when I tried a few weeks ago in Debian Testing. Curiously, it seems to be a race condition because sometimes (5% of the time?) the app loads fine.
The reason is something sets an window as transient for an offscreen window. This causes the transient-loop check introduced by bug 759299 to crash since it assumes the parent window is also a native window. What a transient-for-offcreen window should mean I'm not sure (whether it'll cause the toplevel window of the offscreen to be the transient parent or if it's just ignored).
Created attachment 322535 [details] [review] wayland: Warn if trying to set transient to non-toplevel Setting a GdkWindow transient to a GdkWindow that is not a toplevel (i.e. doesn't have a GdkWindowImplWayland) is invalid API usage, so g_return_if_fail when the parent impl isn't a GdkWindowImplWayland.
Created attachment 322536 [details] [review] GtkWindow: Don't realize popover if added to offscreen window Don't try to realize a popover widget if it was added to an offscreen window. Doing so would cause the popover GdkWindow to be set transient to the offscreen GdkWindow, when running the Wayland backend, which is invalid. Instead wait until the popover is added to a onscreen window before realizing it.
Review of attachment 322535 [details] [review]: Looks right
Review of attachment 322536 [details] [review]: This feels wrong to me to check for an offscreen window in this one place. Can we not instead fix up the transient loop check to not croak ?
Created attachment 322633 [details] [review] wayland: Check actual impl type in transient loop (In reply to Matthias Clasen from comment #7) > This feels wrong to me to check for an offscreen window in this one place. > Can we not instead fix up the transient loop check to not croak ? Would this help ? (untested yet, still building gnome-maps here...)
(In reply to Matthias Clasen from comment #7) > Review of attachment 322536 [details] [review] [review]: > > This feels wrong to me to check for an offscreen window in this one place. > Can we not instead fix up the transient loop check to not croak ? If we don't check it there, or skip setting the transiency in the realize function, we pass, according to the API, invalid input to gdk_window_set_transient_for(). gdk_window_set_transient_for() takes two toplevel GdkWindow's, so passing an offscreen GdkWindow as a parent is not valid.
Maybe we should do what the gdk_window_get_parent_docs say: * Note that you should use gdk_window_get_effective_parent() when * writing generic code that walks up a window hierarchy, because * gdk_window_get_parent() will most likely not do what you expect if * there are offscreen windows in the hierarchy.
The patch worked, so I'm going with it. Attachment 322633 [details] pushed as de38380 - wayland: Check actual impl type in transient loop