screen-share: fix error handling

Make sure damage region gets properly unreferenced in error cases.

Signed-off-by: Stefan Agner <stefan@agner.ch>
dev
Stefan Agner 6 years ago committed by Simon Ser
parent 2b2c9a6f7f
commit 64e2964159
  1. 21
      compositor/screen-share.c

@ -852,19 +852,15 @@ shared_output_repainted(struct wl_listener *listener, void *data)
pixman_image_create_bits(PIXMAN_a8r8g8b8, pixman_image_create_bits(PIXMAN_a8r8g8b8,
width, height, NULL, width, height, NULL,
stride); stride);
if (!so->cache_image) { if (!so->cache_image)
shared_output_destroy(so); goto err_pixman_init;
return;
}
pixman_region32_fini(&damage); pixman_region32_fini(&damage);
pixman_region32_init_rect(&damage, 0, 0, width, height); pixman_region32_init_rect(&damage, 0, 0, width, height);
} }
if (shared_output_ensure_tmp_data(so, &damage) < 0) { if (shared_output_ensure_tmp_data(so, &damage) < 0)
shared_output_destroy(so); goto err_pixman_init;
return;
}
do_yflip = !!(so->output->compositor->capabilities & WESTON_CAP_CAPTURE_YFLIP); do_yflip = !!(so->output->compositor->capabilities & WESTON_CAP_CAPTURE_YFLIP);
@ -894,11 +890,16 @@ shared_output_repainted(struct wl_listener *listener, void *data)
} }
} }
pixman_region32_fini(&damage);
so->cache_dirty = 1; so->cache_dirty = 1;
pixman_region32_fini(&damage);
shared_output_update(so); shared_output_update(so);
return;
err_pixman_init:
pixman_region32_fini(&damage);
shared_output_destroy(so);
} }
static struct shared_output * static struct shared_output *

Loading…
Cancel
Save