xdg_toplevel send_configure: abort on ENOMEM instead of sending partial configure

This commit is contained in:
Dominique Martinet 2017-12-28 16:08:45 +01:00
parent e5dd98c7f5
commit da3ef46daf

View file

@ -924,33 +924,33 @@ 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");
} else { goto out;
*s = ZXDG_TOPLEVEL_V6_STATE_MAXIMIZED;
} }
*s = ZXDG_TOPLEVEL_V6_STATE_MAXIMIZED;
} }
if (surface->toplevel_state->pending.fullscreen) { if (surface->toplevel_state->pending.fullscreen) {
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");
} else { goto out;
*s = ZXDG_TOPLEVEL_V6_STATE_FULLSCREEN;
} }
*s = ZXDG_TOPLEVEL_V6_STATE_FULLSCREEN;
} }
if (surface->toplevel_state->pending.resizing) { if (surface->toplevel_state->pending.resizing) {
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");
} else { goto out;
*s = ZXDG_TOPLEVEL_V6_STATE_RESIZING;
} }
*s = ZXDG_TOPLEVEL_V6_STATE_RESIZING;
} }
if (surface->toplevel_state->pending.activated) { if (surface->toplevel_state->pending.activated) {
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");
} else { goto out;
*s = ZXDG_TOPLEVEL_V6_STATE_ACTIVATED;
} }
*s = ZXDG_TOPLEVEL_V6_STATE_ACTIVATED;
} }
uint32_t width = surface->toplevel_state->pending.width; uint32_t width = surface->toplevel_state->pending.width;
@ -964,6 +964,7 @@ 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);
} }