ilmControl: allow clean shutdown on partial init
authorMarcus Fritzsch <marcus.fritzsch@xse.de>
Tue, 12 Aug 2014 11:27:47 +0000 (13:27 +0200)
committerNobuhiko Tanibata <NOBUHIKO_TANIBATA@denso.co.jp>
Mon, 1 Sep 2014 06:55:43 +0000 (15:55 +0900)
Signed-off-by: Marcus Fritzsch <marcus.fritzsch@xse.de>
ivi-layermanagement-api/ilmControl/src/ilm_control_wayland_platform.c

index ed0a234..0b88998 100644 (file)
@@ -993,13 +993,19 @@ static void destroy_control_resources(void)
         ctx->wl.controller = NULL;
     }
 
-    wl_display_flush(ctx->wl.display);
+    if (ctx->wl.display) {
+        wl_display_flush(ctx->wl.display);
+    }
 
-    wl_event_queue_destroy(ctx->wl.queue);
-    ctx->wl.queue = NULL;
+    if (ctx->wl.registry) {
+        wl_registry_destroy(ctx->wl.registry);
+        ctx->wl.registry = NULL;
+    }
 
-    wl_registry_destroy(ctx->wl.registry);
-    ctx->wl.registry = NULL;
+    if (ctx->wl.queue) {
+        wl_event_queue_destroy(ctx->wl.queue);
+        ctx->wl.queue = NULL;
+    }
 
     if (0 != pthread_mutex_destroy(&ctx->mutex)) {
         fprintf(stderr, "failed to destroy pthread_mutex\n");