tpl_wayland_egl_thread: Changed the order of surface fini. 66/135166/4
authorjoonbum.ko <joonbum.ko@samsung.com>
Thu, 25 May 2017 01:20:17 +0000 (10:20 +0900)
committerSooChan Lim <sc1.lim@samsung.com>
Thu, 22 Jun 2017 08:55:47 +0000 (08:55 +0000)
Change-Id: I191044552c521a435eaf83fa31fecc1615643efd
Signed-off-by: joonbum.ko <joonbum.ko@samsung.com>
src/tpl_wayland_egl_thread.c

index e467a77..d363d18 100644 (file)
@@ -964,21 +964,6 @@ _twe_thread_wl_surface_finalize(GSource *source)
 {
        twe_wl_surf_source *surf_source = (twe_wl_surf_source *)source;
 
-       if (surf_source->committed_buffers) {
-               TPL_OBJECT_LOCK(&surf_source->obj);
-               while (!__tpl_list_is_empty(surf_source->committed_buffers)) {
-                       tbm_surface_h tbm_surface =
-                               (tbm_surface_h)__tpl_list_pop_front(
-                                               surf_source->committed_buffers,
-                                               NULL);
-                       tbm_surface_internal_unref(tbm_surface);
-               }
-
-               __tpl_list_free(surf_source->committed_buffers, NULL);
-               surf_source->committed_buffers = NULL;
-               TPL_OBJECT_UNLOCK(&surf_source->obj);
-       }
-
        __tpl_object_fini(&surf_source->obj);
 
        g_source_remove_unix_fd(source, surf_source->tag);
@@ -1248,6 +1233,21 @@ twe_surface_del(twe_surface_h twe_surface)
        __tpl_list_free(surf_source->in_use_buffers, NULL);
        surf_source->in_use_buffers = NULL;
 
+       if (surf_source->committed_buffers) {
+               TPL_OBJECT_LOCK(&surf_source->obj);
+               while (!__tpl_list_is_empty(surf_source->committed_buffers)) {
+                       tbm_surface_h tbm_surface =
+                               (tbm_surface_h)__tpl_list_pop_front(
+                                               surf_source->committed_buffers,
+                                               NULL);
+                       tbm_surface_internal_unref(tbm_surface);
+               }
+
+               __tpl_list_free(surf_source->committed_buffers, NULL);
+               surf_source->committed_buffers = NULL;
+               TPL_OBJECT_UNLOCK(&surf_source->obj);
+       }
+
        _twe_surface_buffer_flusher_fini(surf_source);
 
        if (surf_source->tbm_queue) {