diff options
author | emersion <contact@emersion.fr> | 2018-06-28 13:30:28 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-28 13:30:28 +0100 |
commit | f01896c9d5e7555ff3e2ab914c068b13cf9189a6 (patch) | |
tree | 88751041083bd16ba9f2467abac09454e29cf52a | |
parent | 9f1d6c58ed16bf2a7c1e4f39b38848adfe426095 (diff) | |
parent | a3e2a77734f98311d017a21a74557041b1627739 (diff) |
Merge pull request #1093 from martinetd/xdg_popup
xdg_shell popup: fix potential segv in handle_destroy
-rw-r--r-- | types/xdg_shell/wlr_xdg_popup.c | 5 | ||||
-rw-r--r-- | types/xdg_shell_v6/wlr_xdg_popup_v6.c | 5 |
2 files changed, 8 insertions, 2 deletions
diff --git a/types/xdg_shell/wlr_xdg_popup.c b/types/xdg_shell/wlr_xdg_popup.c index 284f36ad..bd969147 100644 --- a/types/xdg_shell/wlr_xdg_popup.c +++ b/types/xdg_shell/wlr_xdg_popup.c @@ -152,6 +152,9 @@ static void xdg_popup_handle_grab(struct wl_client *client, wlr_xdg_surface_from_popup_resource(resource); struct wlr_seat_client *seat_client = wlr_seat_client_from_resource(seat_resource); + if (!surface) { + return; + } if (surface->popup->committed) { wl_resource_post_error(surface->popup->resource, @@ -186,7 +189,7 @@ static void xdg_popup_handle_destroy(struct wl_client *client, struct wlr_xdg_surface *surface = wlr_xdg_surface_from_popup_resource(resource); - if (!wl_list_empty(&surface->popups)) { + if (surface && !wl_list_empty(&surface->popups)) { wl_resource_post_error(surface->client->resource, XDG_WM_BASE_ERROR_NOT_THE_TOPMOST_POPUP, "xdg_popup was destroyed while it was not the topmost popup"); diff --git a/types/xdg_shell_v6/wlr_xdg_popup_v6.c b/types/xdg_shell_v6/wlr_xdg_popup_v6.c index 334519a5..378ae963 100644 --- a/types/xdg_shell_v6/wlr_xdg_popup_v6.c +++ b/types/xdg_shell_v6/wlr_xdg_popup_v6.c @@ -174,6 +174,9 @@ static void xdg_popup_handle_grab(struct wl_client *client, xdg_surface_from_xdg_popup_resource(resource); struct wlr_seat_client *seat_client = wlr_seat_client_from_resource(seat_resource); + if (!surface) { + return; + } if (surface->popup->committed) { wl_resource_post_error(surface->popup->resource, @@ -214,7 +217,7 @@ static void xdg_popup_handle_destroy(struct wl_client *client, struct wlr_xdg_surface_v6 *surface = xdg_surface_from_xdg_popup_resource(resource); - if (!wl_list_empty(&surface->popups)) { + if (surface && !wl_list_empty(&surface->popups)) { wl_resource_post_error(surface->client->resource, ZXDG_SHELL_V6_ERROR_NOT_THE_TOPMOST_POPUP, "xdg_popup was destroyed while it was not the topmost popup"); |