screenshot: destroy wl_registry when screenshot deinit 43/181743/4 accepted/tizen/unified/20180619.141908 submit/tizen/20180618.071047
authorJunkyeong Kim <jk0430.kim@samsung.com>
Mon, 18 Jun 2018 05:20:42 +0000 (14:20 +0900)
committerJunkyeong Kim <jk0430.kim@samsung.com>
Mon, 18 Jun 2018 06:10:57 +0000 (15:10 +0900)
Change-Id: Ib0c5b0bb802c26fd27055989ec71f19afad63b44

src/efl_util.c

index 72295c3..652aa1a 100644 (file)
@@ -1802,6 +1802,9 @@ efl_util_screenshot_initialize(int width, int height)
 
         _eflutil.wl.shot.tbm_client = wayland_tbm_client_init(_eflutil.wl.dpy);
         EINA_SAFETY_ON_NULL_GOTO(_eflutil.wl.shot.tbm_client, fail_init);
+
+        wl_registry_destroy(reg);
+        reg = NULL;
      }
 
    if (_eflutil.wl.shot.noti == 0)
@@ -1852,6 +1855,8 @@ fail_memory:
    set_last_result(EFL_UTIL_ERROR_OUT_OF_MEMORY);
    return NULL;
 fail_init:
+   if (reg)
+     wl_registry_destroy(reg);
    if (screenshot)
      efl_util_screenshot_deinitialize(screenshot);
    _screenshot_mutex_unlock();
@@ -1875,12 +1880,6 @@ efl_util_screenshot_deinitialize(efl_util_screenshot_h screenshot)
    free(screenshot);
    g_screenshot = NULL;
 
-   if (_eflutil.wl.shot.queue)
-     {
-        wl_event_queue_destroy(_eflutil.wl.shot.queue);
-        _eflutil.wl.shot.queue = NULL;
-     }
-
    if (_eflutil.wl.shot.screenshooter)
      {
         screenshooter_destroy(_eflutil.wl.shot.screenshooter);
@@ -1892,6 +1891,12 @@ efl_util_screenshot_deinitialize(efl_util_screenshot_h screenshot)
         _eflutil.wl.shot.tz_screenshooter = NULL;
      }
 
+   if (_eflutil.wl.shot.queue)
+     {
+        wl_event_queue_destroy(_eflutil.wl.shot.queue);
+        _eflutil.wl.shot.queue = NULL;
+     }
+
    _screenshot_mutex_unlock();
    _screenshot_mutex_destory();