xdg_toplevel send_configure: also post no_memory to resource on ENOMEM

This commit is contained in:
Dominique Martinet 2017-12-28 16:33:08 +01:00
parent 8e24aaa3c6
commit b0e440b5b1
1 changed files with 9 additions and 5 deletions

View File

@ -924,7 +924,7 @@ static void wlr_xdg_toplevel_v6_send_configure(
s = wl_array_add(&states, sizeof(uint32_t)); s = wl_array_add(&states, sizeof(uint32_t));
if (!s) { if (!s) {
wlr_log(L_ERROR, "Could not allocate state for maximized xdg_toplevel"); wlr_log(L_ERROR, "Could not allocate state for maximized xdg_toplevel");
goto out; goto error_out;
} }
*s = ZXDG_TOPLEVEL_V6_STATE_MAXIMIZED; *s = ZXDG_TOPLEVEL_V6_STATE_MAXIMIZED;
} }
@ -932,7 +932,7 @@ static void wlr_xdg_toplevel_v6_send_configure(
s = wl_array_add(&states, sizeof(uint32_t)); s = wl_array_add(&states, sizeof(uint32_t));
if (!s) { if (!s) {
wlr_log(L_ERROR, "Could not allocate state for fullscreen xdg_toplevel"); wlr_log(L_ERROR, "Could not allocate state for fullscreen xdg_toplevel");
goto out; goto error_out;
} }
*s = ZXDG_TOPLEVEL_V6_STATE_FULLSCREEN; *s = ZXDG_TOPLEVEL_V6_STATE_FULLSCREEN;
} }
@ -940,7 +940,7 @@ static void wlr_xdg_toplevel_v6_send_configure(
s = wl_array_add(&states, sizeof(uint32_t)); s = wl_array_add(&states, sizeof(uint32_t));
if (!s) { if (!s) {
wlr_log(L_ERROR, "Could not allocate state for resizing xdg_toplevel"); wlr_log(L_ERROR, "Could not allocate state for resizing xdg_toplevel");
goto out; goto error_out;
} }
*s = ZXDG_TOPLEVEL_V6_STATE_RESIZING; *s = ZXDG_TOPLEVEL_V6_STATE_RESIZING;
} }
@ -948,7 +948,7 @@ static void wlr_xdg_toplevel_v6_send_configure(
s = wl_array_add(&states, sizeof(uint32_t)); s = wl_array_add(&states, sizeof(uint32_t));
if (!s) { if (!s) {
wlr_log(L_ERROR, "Could not allocate state for activated xdg_toplevel"); wlr_log(L_ERROR, "Could not allocate state for activated xdg_toplevel");
goto out; goto error_out;
} }
*s = ZXDG_TOPLEVEL_V6_STATE_ACTIVATED; *s = ZXDG_TOPLEVEL_V6_STATE_ACTIVATED;
} }
@ -964,8 +964,12 @@ static void wlr_xdg_toplevel_v6_send_configure(
zxdg_toplevel_v6_send_configure(surface->toplevel_state->resource, width, zxdg_toplevel_v6_send_configure(surface->toplevel_state->resource, width,
height, &states); height, &states);
out:
wl_array_release(&states); wl_array_release(&states);
return;
error_out:
wl_array_release(&states);
wl_resource_post_no_memory(surface->toplevel_state->resource);
} }
static void wlr_xdg_surface_send_configure(void *user_data) { static void wlr_xdg_surface_send_configure(void *user_data) {