tpl_wayland_egl_thread: Fixed an error related to prepared flag. 78/144778/1
authorjoonbum.ko <joonbum.ko@samsung.com>
Fri, 18 Aug 2017 01:46:56 +0000 (10:46 +0900)
committerjoonbum.ko <joonbum.ko@samsung.com>
Fri, 18 Aug 2017 01:47:01 +0000 (10:47 +0900)
 - The code that set prepared to TRUE was wrong.
 - Fixed an issue where wl_display_cancel_read() could be called multiple times,
  even if wl_display_prepare_read_queue was only called once due to the prepared flag.

Change-Id: Ibdbe92ed3bbe00ffac6570fac5f76cf8f243d706
Signed-off-by: joonbum.ko <joonbum.ko@samsung.com>
src/tpl_wayland_egl_thread.c

index 2e09c08..6f5f608 100644 (file)
@@ -332,10 +332,10 @@ _twe_thread_wl_disp_prepare(GSource *source, gint *time)
                                                                                          disp_source->ev_queue) == -1) {
                        _twe_display_print_err(disp_source, "dispatch_queue_pending");
                }
-
-               disp_source->prepared = TPL_TRUE;
        }
 
+       disp_source->prepared = TPL_TRUE;
+
        wl_display_flush(disp_source->disp);
        *time = -1;
 
@@ -353,6 +353,9 @@ _twe_thread_wl_disp_check(GSource *source)
                return ret;
        }
 
+       if (!disp_source->prepared)
+               return ret;
+
        if (disp_source->gfd.revents & G_IO_IN) {
                if (wl_display_read_events(disp_source->disp) == -1)
                        _twe_display_print_err(disp_source, "read_event.");