libweston/desktop: avoid weston crash while xdg_surface ack_configure

checks the resource and sends a protocol error if the client tries to
send a request to an inert object then returns out of the request
handler

Signed-off-by: Jeri Li <jeri.li@mediatek.com>
(cherry picked from commit 04f27f1be2)
This commit is contained in:
Jeri Li 2024-09-08 16:21:49 +08:00 committed by Marius Vlad
parent e056153bf4
commit 502e4bd31d
2 changed files with 16 additions and 0 deletions

View file

@ -1200,6 +1200,14 @@ weston_desktop_xdg_surface_protocol_ack_configure(struct wl_client *wl_client,
{
struct weston_desktop_surface *dsurface =
wl_resource_get_user_data(resource);
if (dsurface == NULL) {
wl_resource_post_error(resource,
ZXDG_SURFACE_V6_ERROR_NOT_CONSTRUCTED,
"xdg surface already destroyed configure "
"serial: %u", serial);
return;
}
struct weston_desktop_xdg_surface *surface =
weston_desktop_surface_get_implementation_data(dsurface);
struct weston_desktop_xdg_surface_configure *configure, *temp;

View file

@ -1414,6 +1414,14 @@ weston_desktop_xdg_surface_protocol_ack_configure(struct wl_client *wl_client,
{
struct weston_desktop_surface *dsurface =
wl_resource_get_user_data(resource);
if (dsurface == NULL) {
wl_resource_post_error(resource,
XDG_SURFACE_ERROR_DEFUNCT_ROLE_OBJECT,
"xdg surface already destroyed configure "
"serial: %u", serial);
return;
}
struct weston_desktop_xdg_surface *surface =
weston_desktop_surface_get_implementation_data(dsurface);
struct weston_desktop_xdg_surface_configure *configure, *temp;