gtk-embed: Don't try to compare with unrealized window

After having embedded a Gtk window, we start to listen for the
corresponding MetaWindow to know when it has been mapped by the
compositor. If the embedder does not realize the window immediately,
and some other window is created and mapped before the embedder
realizes the window, we would prior to this patch try to dereference
the not created GdkWindow. Fix this by NULL checking the GdkWindow
before dereferencing. We will never miss the needed MetaWindow creation
since it can not have been mapped have it not yet been realized.

https://bugzilla.gnome.org/show_bug.cgi?id=776130
This commit is contained in:
Jonas Ådahl 2016-12-15 19:34:10 +08:00
parent cdd23d9cc7
commit c131c44ef6

View File

@ -66,7 +66,7 @@ shell_gtk_embed_window_created_cb (MetaDisplay *display,
Window xwindow = meta_window_get_xwindow (window); Window xwindow = meta_window_get_xwindow (window);
GdkWindow *gdk_window = gtk_widget_get_window (GTK_WIDGET (priv->window)); GdkWindow *gdk_window = gtk_widget_get_window (GTK_WIDGET (priv->window));
if (xwindow == gdk_x11_window_get_xid (gdk_window)) if (gdk_window && xwindow == gdk_x11_window_get_xid (gdk_window))
{ {
ClutterActor *window_actor = ClutterActor *window_actor =
CLUTTER_ACTOR (meta_window_get_compositor_private (window)); CLUTTER_ACTOR (meta_window_get_compositor_private (window));