[mutter] MetaWaylandSurface: Don't assume a toplevel always have a MetaWindow



commit 8b0b0cf028fcbe9a39db0c10f313668c74b0981b
Author: Jonas Ådahl <jadahl gmail com>
Date:   Thu Sep 24 08:24:54 2015 +0800

    MetaWaylandSurface: Don't assume a toplevel always have a MetaWindow
    
    When committing a toplevel surface we might no longer have a MetaWindow
    associated with it. The reason may vary but some are: a popup was
    dismissed, the client attached and committed a NULL buffer to a
    wl_surface with the wl_shell_surface role, the client committed a
    buffer to a wl_surface which previously had an toplevel window role
    which extension object was destroyed.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=755490

 src/wayland/meta-wayland-surface.c |   15 +++++----------
 1 files changed, 5 insertions(+), 10 deletions(-)
---
diff --git a/src/wayland/meta-wayland-surface.c b/src/wayland/meta-wayland-surface.c
index 2d7a9c7..f51b124 100644
--- a/src/wayland/meta-wayland-surface.c
+++ b/src/wayland/meta-wayland-surface.c
@@ -351,12 +351,6 @@ toplevel_surface_commit (MetaWaylandSurfaceRole  *surface_role,
           return;
         }
     }
-  else if (META_IS_WAYLAND_SURFACE_ROLE_XDG_POPUP (surface->role))
-    {
-      /* Ignore commits if we couldn't grab the pointer */
-      if (!window)
-        return;
-    }
   else
     {
       if (surface->buffer == NULL)
@@ -369,10 +363,11 @@ toplevel_surface_commit (MetaWaylandSurfaceRole  *surface_role,
         }
     }
 
-  g_assert (window != NULL);
-
-  /* We resize X based surfaces according to X events */
-  if (window->client_type == META_WINDOW_CLIENT_TYPE_WAYLAND)
+  /* Update the state of the MetaWindow if we still have one. We might not if
+   * the window was unmanaged (for example popup destroyed, NULL buffer attached to
+   * wl_shell_surface wl_surface, xdg_surface object was destroyed, etc).
+   */
+  if (window && window->client_type == META_WINDOW_CLIENT_TYPE_WAYLAND)
     {
       MetaRectangle geom = { 0 };
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]