provider: clean up static global variables
authorYoungJun Cho <yj44.cho@samsung.com>
Tue, 10 Oct 2017 06:58:37 +0000 (15:58 +0900)
committerHyunho Kang <hhstark.kang@samsung.com>
Mon, 6 Nov 2017 07:06:53 +0000 (16:06 +0900)
Change-Id: I8e5d4ae7a35097e0e52227d62e0ba8ca74c9a6a7
Signed-off-by: YoungJun Cho <yj44.cho@samsung.com>
screen_connector_provider/src/screen_connector_provider.c

index cc274b9..b6e73d8 100755 (executable)
@@ -35,8 +35,8 @@
 
 #define LOG_TAG "SC_PROVIDER"
 
-static int __init_count;
-static struct tizen_remote_surface_manager *__rsm;
+static int __init_count = 0;
+static struct tizen_remote_surface_manager *__rsm = NULL;
 
 struct screen_connector_provider_s {
        struct wl_surface *surface;
@@ -200,8 +200,10 @@ EXPORT_API int screen_connector_provider_init(void)
        Ecore_Wl_Global *global;
        Eina_Inlist *globals;
 
-       if (__init_count > 0)
+       if (__init_count > 0) {
+               __init_count++;
                return 0;
+       }
 
        ecore_wl_init(NULL);
 
@@ -235,8 +237,10 @@ EXPORT_API int screen_connector_provider_init(void)
 
 EXPORT_API int screen_connector_provider_fini(void)
 {
-       if (__init_count > 1)
+       if (__init_count > 1) {
+               __init_count--;
                return 0;
+       }
 
        if (__rsm)
                tizen_remote_surface_manager_destroy(__rsm);