From b687940cd58ec772fa99928461e4f0f45d217316 Mon Sep 17 00:00:00 2001 From: Benjamin Franzke Date: Tue, 10 Apr 2012 18:28:54 +0200 Subject: [PATCH 1/2] compositor: Remove wl_output-global on unplug Or we would segfault when a client binds to a output thats already destroyed. --- src/compositor.c | 9 +++++++-- src/compositor.h | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/compositor.c b/src/compositor.c index 96296cc8..8686c1d9 100644 --- a/src/compositor.c +++ b/src/compositor.c @@ -2224,8 +2224,12 @@ weston_shader_init(struct weston_shader *shader, WL_EXPORT void weston_output_destroy(struct weston_output *output) { + struct weston_compositor *c = output->compositor; + pixman_region32_fini(&output->region); pixman_region32_fini(&output->previous_damage); + + wl_display_remove_global(c->wl_display, output->global); } WL_EXPORT void @@ -2313,8 +2317,9 @@ weston_output_init(struct weston_output *output, struct weston_compositor *c, wl_list_init(&output->frame_callback_list); - wl_display_add_global(c->wl_display, - &wl_output_interface, output, bind_output); + output->global = + wl_display_add_global(c->wl_display, &wl_output_interface, + output, bind_output); } static void diff --git a/src/compositor.h b/src/compositor.h index 1b37356e..90223135 100644 --- a/src/compositor.h +++ b/src/compositor.h @@ -73,6 +73,7 @@ enum dpms_enum { struct weston_output { struct wl_list link; + struct wl_global *global; struct weston_compositor *compositor; struct weston_matrix matrix; struct wl_list frame_callback_list; From 78db8481961f679cd647ba38ca96fcb3600e01a8 Mon Sep 17 00:00:00 2001 From: Benjamin Franzke Date: Tue, 10 Apr 2012 18:35:33 +0200 Subject: [PATCH 2/2] compositor: Damage output in weston_output_init So that hotplugged outputs are marked damaged initially. --- src/compositor.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/compositor.c b/src/compositor.c index 8686c1d9..a71b7df5 100644 --- a/src/compositor.c +++ b/src/compositor.c @@ -2314,6 +2314,7 @@ weston_output_init(struct weston_output *output, struct weston_compositor *c, output->flags = flags; weston_output_move(output, x, y); + weston_output_damage(output); wl_list_init(&output->frame_callback_list);