screencopy: simplify capture error handling

Signed-off-by: liupeng <liupeng01@kylinos.cn>
This commit is contained in:
liupeng 2026-03-04 09:45:15 +08:00
parent 55bb69e2c4
commit 1b8c3ea8c5

View file

@ -505,7 +505,7 @@ static void capture_output(struct wl_client *wl_client,
wl_resource_set_implementation(frame->resource, &frame_impl, frame,
frame_handle_resource_destroy);
if (output == NULL) {
if (output == NULL || !output->enabled) {
wl_resource_set_user_data(frame->resource, NULL);
zwlr_screencopy_frame_v1_send_failed(frame->resource);
free(frame);
@ -522,10 +522,6 @@ static void capture_output(struct wl_client *wl_client,
wl_signal_add(&output->events.destroy, &frame->output_destroy);
frame->output_destroy.notify = frame_handle_output_destroy;
if (output == NULL || !output->enabled) {
goto error;
}
struct wlr_renderer *renderer = output->renderer;
assert(renderer);