[PATCH weston 1/2] compositor: don't crash if destroying a compositor without a backend

Giulio Camuffo giuliocamuffo at gmail.com
Sat Oct 3 06:25:15 PDT 2015


Calling weston_compositor_destroy() on a pointer returned by
weston_compositor_create() should be always valid, even if the
compositor does not have yet a backend.

Signed-off-by: Giulio Camuffo <giuliocamuffo at gmail.com>
---
 src/compositor.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/compositor.c b/src/compositor.c
index 125afd5..f8437e8 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -4767,7 +4767,8 @@ weston_compositor_destroy(struct weston_compositor *compositor)
 
 	weston_compositor_xkb_destroy(compositor);
 
-	compositor->backend->destroy(compositor);
+	if (compositor->backend)
+		compositor->backend->destroy(compositor);
 	free(compositor);
 }
 
-- 
2.6.0



More information about the wayland-devel mailing list