Merge pull request #1093 from martinetd/xdg_popup

xdg_shell popup: fix potential segv in handle_destroy
master
emersion 7 years ago committed by GitHub
commit f01896c9d5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -152,6 +152,9 @@ static void xdg_popup_handle_grab(struct wl_client *client,
wlr_xdg_surface_from_popup_resource(resource); wlr_xdg_surface_from_popup_resource(resource);
struct wlr_seat_client *seat_client = struct wlr_seat_client *seat_client =
wlr_seat_client_from_resource(seat_resource); wlr_seat_client_from_resource(seat_resource);
if (!surface) {
return;
}
if (surface->popup->committed) { if (surface->popup->committed) {
wl_resource_post_error(surface->popup->resource, 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 = struct wlr_xdg_surface *surface =
wlr_xdg_surface_from_popup_resource(resource); 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, wl_resource_post_error(surface->client->resource,
XDG_WM_BASE_ERROR_NOT_THE_TOPMOST_POPUP, XDG_WM_BASE_ERROR_NOT_THE_TOPMOST_POPUP,
"xdg_popup was destroyed while it was not the topmost popup"); "xdg_popup was destroyed while it was not the topmost popup");

@ -174,6 +174,9 @@ static void xdg_popup_handle_grab(struct wl_client *client,
xdg_surface_from_xdg_popup_resource(resource); xdg_surface_from_xdg_popup_resource(resource);
struct wlr_seat_client *seat_client = struct wlr_seat_client *seat_client =
wlr_seat_client_from_resource(seat_resource); wlr_seat_client_from_resource(seat_resource);
if (!surface) {
return;
}
if (surface->popup->committed) { if (surface->popup->committed) {
wl_resource_post_error(surface->popup->resource, 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 = struct wlr_xdg_surface_v6 *surface =
xdg_surface_from_xdg_popup_resource(resource); 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, wl_resource_post_error(surface->client->resource,
ZXDG_SHELL_V6_ERROR_NOT_THE_TOPMOST_POPUP, ZXDG_SHELL_V6_ERROR_NOT_THE_TOPMOST_POPUP,
"xdg_popup was destroyed while it was not the topmost popup"); "xdg_popup was destroyed while it was not the topmost popup");

Loading…
Cancel
Save