wayland: Post protocol error if popup parent has no surface role

This commit is contained in:
Vlad Zahorodnii 2023-09-01 14:28:08 +03:00
parent dc2965efad
commit 1e255265c3

View file

@ -219,6 +219,14 @@ void XdgSurfaceInterfacePrivate::xdg_surface_get_popup(Resource *resource, uint3
XdgSurfaceInterface *parentXdgSurface = XdgSurfaceInterface::get(parentResource);
SurfaceInterface *parentSurface = nullptr;
if (parentXdgSurface) {
const SurfaceRole *parentSurfaceRole = SurfaceRole::get(parentXdgSurface->surface());
if (!parentSurfaceRole) {
auto shellPrivate = XdgShellInterfacePrivate::get(shell);
wl_resource_post_error(shellPrivate->resourceForXdgSurface(q)->handle,
QtWaylandServer::xdg_wm_base::error_invalid_popup_parent,
"parent surface has no surface role");
return;
}
parentSurface = parentXdgSurface->surface();
}