[PATCH weston 2/4] Add safety checks to weston_compositor_shutdown

Daniel Stone daniel at fooishbar.org
Mon Jun 18 11:10:31 PDT 2012


Make it safe to call weston_compositor_shutdown on a
not-fully-initialised weston_compositor.

Signed-off-by: Daniel Stone <daniel at fooishbar.org>
---
 src/compositor.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/compositor.c b/src/compositor.c
index 224d9ff..cdb6d01 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -3076,7 +3076,8 @@ weston_compositor_shutdown(struct weston_compositor *ec)
 {
 	struct weston_output *output, *next;
 
-	wl_event_source_remove(ec->idle_source);
+	if (ec->idle_source)
+		wl_event_source_remove(ec->idle_source);
 	if (ec->input_loop_source)
 		wl_event_source_remove(ec->input_loop_source);
 
@@ -3091,7 +3092,8 @@ weston_compositor_shutdown(struct weston_compositor *ec)
 	wl_array_release(&ec->vertices);
 	wl_array_release(&ec->indices);
 
-	wl_event_loop_destroy(ec->input_loop);
+	if (ec->input_loop)
+		wl_event_loop_destroy(ec->input_loop);
 }
 
 static int on_term_signal(int signal_number, void *data)
-- 
1.7.10



More information about the wayland-devel mailing list