Skip to content
This repository was archived by the owner on Nov 1, 2021. It is now read-only.

Commit 9bed12b

Browse files
committed
Fix a whoopsie
1 parent e9939fc commit 9bed12b

1 file changed

Lines changed: 16 additions & 10 deletions

File tree

types/wlr_zext_screencopy_v1.c

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -212,11 +212,14 @@ static void surface_commit(struct wl_client *client,
212212
surface->current_buffer.resource = surface->staged_buffer.resource;
213213
surface->staged_buffer.resource = NULL;
214214

215-
wl_list_remove(&surface->staged_buffer.destroy.link);
216-
wl_resource_add_destroy_listener(surface->current_buffer.resource,
217-
&surface->current_buffer.destroy);
218-
surface->current_buffer.destroy.notify =
219-
surface_handle_committed_buffer_destroy;
215+
if (surface->current_buffer.resource) {
216+
wl_list_remove(&surface->staged_buffer.destroy.link);
217+
wl_resource_add_destroy_listener(
218+
surface->current_buffer.resource,
219+
&surface->current_buffer.destroy);
220+
surface->current_buffer.destroy.notify =
221+
surface_handle_committed_buffer_destroy;
222+
}
220223

221224
pixman_region32_copy(&surface->current_buffer.damage,
222225
&surface->staged_buffer.damage);
@@ -230,11 +233,14 @@ static void surface_commit(struct wl_client *client,
230233
surface->staged_cursor_buffer.resource;
231234
surface->staged_cursor_buffer.resource = NULL;
232235

233-
wl_list_remove(&surface->staged_cursor_buffer.destroy.link);
234-
wl_resource_add_destroy_listener(surface->current_cursor_buffer.resource,
235-
&surface->current_cursor_buffer.destroy);
236-
surface->current_cursor_buffer.destroy.notify =
237-
surface_handle_committed_cursor_buffer_destroy;
236+
if (surface->current_cursor_buffer.resource) {
237+
wl_list_remove(&surface->staged_cursor_buffer.destroy.link);
238+
wl_resource_add_destroy_listener(
239+
surface->current_cursor_buffer.resource,
240+
&surface->current_cursor_buffer.destroy);
241+
surface->current_cursor_buffer.destroy.notify =
242+
surface_handle_committed_cursor_buffer_destroy;
243+
}
238244

239245
pixman_region32_copy(&surface->current_cursor_buffer.damage,
240246
&surface->staged_cursor_buffer.damage);

0 commit comments

Comments
 (0)