init: use display_wrapper to ensure that proxy has a queue 88/114388/1
authorBoram Park <boram1288.park@samsung.com>
Mon, 13 Feb 2017 07:52:54 +0000 (16:52 +0900)
committerBoram Park <boram1288.park@samsung.com>
Mon, 13 Feb 2017 07:53:07 +0000 (16:53 +0900)
Change-Id: Ie853212a6e42f9c568d52b46817a193e238ed2e1

src/efl_util.c

index 5162b57..897d291 100644 (file)
@@ -288,6 +288,7 @@ _cb_info_find_by_win(Evas_Object *win,
 static Eina_Bool
 _wl_init(void)
 {
+   struct wl_display *display_wrapper = NULL;
    struct wl_registry *reg = NULL;
 
    if (_eflutil.wl.init) return EINA_TRUE;
@@ -297,19 +298,27 @@ _wl_init(void)
    _eflutil.wl.dpy = ecore_wl_display_get();
    EINA_SAFETY_ON_NULL_GOTO(_eflutil.wl.dpy, fail);
 
+   display_wrapper = wl_proxy_create_wrapper(_eflutil.wl.dpy);
+   EINA_SAFETY_ON_NULL_GOTO(display_wrapper, fail);
+
    _eflutil.wl.queue = wl_display_create_queue(_eflutil.wl.dpy);
    EINA_SAFETY_ON_NULL_GOTO(_eflutil.wl.queue, fail);
 
-   reg = wl_display_get_registry(_eflutil.wl.dpy);
+   wl_proxy_set_queue((struct wl_proxy *)display_wrapper, _eflutil.wl.queue);
+
+   reg = wl_display_get_registry(display_wrapper);
+   wl_proxy_wrapper_destroy(display_wrapper);
    EINA_SAFETY_ON_NULL_GOTO(reg, fail);
 
-   wl_proxy_set_queue((struct wl_proxy*)reg, _eflutil.wl.queue);
    wl_registry_add_listener(reg, &_wl_reg_listener, NULL);
 
    _eflutil.wl.init = EINA_TRUE;
 
    return EINA_TRUE;
 fail:
+   if (display_wrapper)
+     wl_proxy_wrapper_destroy(display_wrapper);
+
    if (_eflutil.wl.queue)
      {
         wl_event_queue_destroy(_eflutil.wl.queue);
@@ -1554,11 +1563,12 @@ efl_util_screenshot_initialize(int width, int height)
         _eflutil.wl.shot.queue = wl_display_create_queue(_eflutil.wl.dpy);
         EINA_SAFETY_ON_NULL_GOTO(_eflutil.wl.shot.queue, fail_init);
 
+        wl_proxy_set_queue((struct wl_proxy *)display_wrapper, _eflutil.wl.shot.queue);
+
         reg = wl_display_get_registry(display_wrapper);
+        wl_proxy_wrapper_destroy(display_wrapper);
         EINA_SAFETY_ON_NULL_GOTO(reg, fail_init);
 
-        wl_proxy_set_queue((struct wl_proxy*)reg, _eflutil.wl.shot.queue);
-
         wl_registry_add_listener(reg, &_wl_reg_screenshooter_listener, NULL);
 
         ret = wl_display_roundtrip_queue(_eflutil.wl.dpy, _eflutil.wl.shot.queue);