[mutter] wayland: Fail when popup parent does not have an allowed role



commit f328890ed13aff675252511fad143bbd692f66b3
Author: Jonas Ådahl <jadahl gmail com>
Date:   Tue Feb 10 20:58:09 2015 +0800

    wayland: Fail when popup parent does not have an allowed role
    
    An xdg_popup may only have another xdg_popup or xdg_surface as a parent,
    so send an error if it provides an invalid parent.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=744452

 src/wayland/meta-wayland-surface.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/src/wayland/meta-wayland-surface.c b/src/wayland/meta-wayland-surface.c
index e5960bd..5904eac 100644
--- a/src/wayland/meta-wayland-surface.c
+++ b/src/wayland/meta-wayland-surface.c
@@ -1069,6 +1069,14 @@ xdg_shell_get_xdg_popup (struct wl_client *client,
                                      XDG_SHELL_ERROR_ROLE) != 0)
     return;
 
+  if (parent_surf->xdg_popup == NULL && parent_surf->xdg_surface == NULL)
+    {
+      wl_resource_post_error (resource,
+                              XDG_POPUP_ERROR_INVALID_PARENT,
+                              "invalid parent surface");
+      return;
+    }
+
   surface->xdg_popup = wl_resource_create (client, &xdg_popup_interface, wl_resource_get_version (resource), 
id);
   wl_resource_set_implementation (surface->xdg_popup, &meta_wayland_xdg_popup_interface, surface, 
xdg_popup_destructor);
 


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