[PATCH weston 4/5] compositor-drm: Remove destroy listeners when disabling planes

Ander Conselvan de Oliveira conselvan2 at gmail.com
Tue Jun 26 07:09:14 PDT 2012


When an unused plane is disabled, the destroy listener for a previously
used buffer needs to be removed. This fixes a crash when an overlay
would be reenabled using the same buffer as before, causing the destroy
listener to be inserted twice.
---
 src/compositor-drm.c |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/compositor-drm.c b/src/compositor-drm.c
index d969d52..6c182d7 100644
--- a/src/compositor-drm.c
+++ b/src/compositor-drm.c
@@ -29,6 +29,7 @@
 #include <fcntl.h>
 #include <unistd.h>
 #include <linux/input.h>
+#include <assert.h>
 
 #include <xf86drm.h>
 #include <xf86drmMode.h>
@@ -520,8 +521,13 @@ drm_disable_unused_sprites(struct weston_output *output_base)
 			weston_log("failed to disable plane: %d: %s\n",
 				ret, strerror(errno));
 		drmModeRmFB(c->drm.fd, s->fb_id);
-		s->surface = NULL;
-		s->pending_surface = NULL;
+
+		if (s->surface) {
+			s->surface = NULL;
+			wl_list_remove(&s->destroy_listener.link);
+		}
+
+		assert(!s->pending_surface);
 		s->fb_id = 0;
 		s->pending_fb_id = 0;
 	}
-- 
1.7.9.5



More information about the wayland-devel mailing list