watcher: trs: clean up screen_connector_trs_init()
authorYoungJun Cho <yj44.cho@samsung.com>
Tue, 10 Oct 2017 08:56:29 +0000 (17:56 +0900)
committerHyunho Kang <hhstark.kang@samsung.com>
Thu, 19 Oct 2017 00:35:35 +0000 (09:35 +0900)
Change-Id: I3673fe5ab1f6044f01a2474356e2f067f1a0d738
Signed-off-by: YoungJun Cho <yj44.cho@samsung.com>
screen_connector_watcher/src/screen_connector_trs.c

index 548fcc1..bbe7ef4 100644 (file)
@@ -33,9 +33,9 @@
 #define LOG_TAG "SC_WATCHER"
 
 static struct tizen_remote_surface_manager *__rsm = NULL;
-static struct wayland_tbm_client *__tbm_client;
+static struct wayland_tbm_client *__tbm_client = NULL;
 static struct wl_tbm *__tbm = NULL;
-static bool __is_init;
+static bool __is_init = false;
 
 struct wl_tbm *screen_connector_get_tbm()
 {
@@ -65,6 +65,7 @@ int screen_connector_trs_init(void)
        if (!registry || !globals) {
                LOGE("could not get registry(%p) or global list(%p)", registry,
                                globals);
+               ecore_wl_shutdown();
                return -1;
        }
 
@@ -78,18 +79,24 @@ int screen_connector_trs_init(void)
 
        if (!__rsm) {
                LOGE("could not get remote surface manager");
+               ecore_wl_shutdown();
                return -1;
        }
 
        __tbm_client = (struct wayland_tbm_client *)wayland_tbm_client_init(ecore_wl_display_get());
        if (!__tbm_client) {
                LOGE("could not get tbm client");
+               tizen_remote_surface_manager_destroy(__rsm);
+               ecore_wl_shutdown();
                return -1;
        }
 
        __tbm = (struct wl_tbm *)wayland_tbm_client_get_wl_tbm(__tbm_client);
        if (!__tbm) {
                LOGE("could not get tbm");
+               wayland_tbm_client_deinit(__tbm_client);
+               tizen_remote_surface_manager_destroy(__rsm);
+               ecore_wl_shutdown();
                return -1;
        }