Remove output instead of terminating display when a wayland backend view closed

This commit is contained in:
emersion 2017-12-13 21:48:59 +01:00
parent 96f09c7492
commit 257559d890
No known key found for this signature in database
GPG Key ID: 0FDE7BE0E88F5E48
3 changed files with 9 additions and 3 deletions

View File

@ -154,6 +154,8 @@ static void wlr_wl_output_destroy(struct wlr_output *_output) {
wl_signal_emit(&output->backend->backend.events.output_remove,
&output->wlr_output);
wl_list_remove(&output->link);
if (output->cursor.buf_size != 0) {
assert(output->cursor.data);
assert(output->cursor.buffer);
@ -171,6 +173,7 @@ static void wlr_wl_output_destroy(struct wlr_output *_output) {
if (output->frame_callback) {
wl_callback_destroy(output->frame_callback);
}
eglDestroySurface(output->backend->egl.display, output->surface);
wl_egl_window_destroy(output->egl_window);
zxdg_toplevel_v6_destroy(output->xdg_toplevel);
@ -233,7 +236,7 @@ static void xdg_toplevel_handle_close(void *data, struct zxdg_toplevel_v6 *xdg_t
struct wlr_wl_backend_output *output = data;
assert(output && output->xdg_toplevel == xdg_toplevel);
wl_display_terminate(output->backend->local_display);
wlr_output_destroy((struct wlr_output *)output);
}
static struct zxdg_toplevel_v6_listener xdg_toplevel_listener = {

View File

@ -21,7 +21,10 @@ static void pointer_handle_enter(void *data, struct wl_pointer *wl_pointer,
struct wlr_wl_pointer *wlr_wl_pointer = (struct wlr_wl_pointer *)dev->pointer;
struct wlr_wl_backend_output *output =
wlr_wl_output_for_surface(wlr_wl_dev->backend, surface);
assert(output);
if (!output) {
// GNOME sends a pointer enter when the surface is being destroyed
return;
}
wlr_wl_pointer->current_output = output;
output->enter_serial = serial;
wlr_wl_output_update_cursor(output);

View File

@ -272,9 +272,9 @@ void wlr_output_destroy(struct wlr_output *output) {
struct wlr_output_mode *mode, *tmp_mode;
wl_list_for_each_safe(mode, tmp_mode, &output->modes, link) {
wl_list_remove(&mode->link);
free(mode);
}
wl_list_remove(&output->modes);
if (output->impl && output->impl->destroy) {
output->impl->destroy(output);
} else {