e_hwc_window_queue: do not destroy the equeue at _e_hwc_window_queue_cb_destroy. 33/194033/1
authorSooChan Lim <sc1.lim@samsung.com>
Mon, 26 Nov 2018 01:52:43 +0000 (10:52 +0900)
committerSooChan Lim <sc1.lim@samsung.com>
Wed, 28 Nov 2018 10:34:00 +0000 (19:34 +0900)
It makes the curruption when it destroys the equeue in the callback function

Change-Id: Ic05866c04a10a8def6acec77a80ace789ea4c89a

src/bin/e_hwc_window_queue.c

index 6e6cad8d2bf333f61bd2483f4a7071245a226d0b..b766f553d37d46aabc4e815bc88a3e6e83aae195 100644 (file)
@@ -595,6 +595,24 @@ _e_hwc_window_queue_cb_dequeueable(tbm_surface_queue_h surface_queue, void *data
      }
 }
 
+static void
+_e_hwc_window_queue_destroy(E_Hwc_Window_Queue *queue)
+{
+   E_Hwc_Window_Queue_Buffer *queue_buffer = NULL;
+
+   if (_hwc_winq_mgr)
+     eina_hash_del(_hwc_winq_mgr->hwc_winq_hash, &queue->tqueue, queue);
+
+   EHWQINF("Destroy tq:%p", NULL, queue, queue->tqueue);
+
+   EINA_LIST_FREE(queue->buffers, queue_buffer)
+     _e_hwc_window_queue_buffer_destroy(queue_buffer);
+
+   wl_signal_emit(&queue->destroy_signal, queue);
+
+   E_FREE(queue);
+}
+
 static Eina_Bool
 _e_hwc_window_queue_prepare_set(E_Hwc_Window_Queue *queue, E_Hwc_Window *hwc_window)
 {
@@ -685,6 +703,11 @@ _e_hwc_window_queue_unset(E_Hwc_Window_Queue *queue)
         if (!_e_hwc_window_queue_prepare_set(queue, hwc_window))
           ERR("fail to queue_prepare_set for user_pending_set queue:%p hwc_window:%p", queue, hwc_window);
      }
+   else
+     {
+         /* delete the E_Hwc_Window_Queue */
+         _e_hwc_window_queue_destroy(queue);
+     }
 }
 
 #if 0
@@ -783,30 +806,14 @@ _e_hwc_window_queue_cb_accepted_state_change(void *data, E_Hwc_Window *hwc_windo
      _e_hwc_window_queue_set(queue);
 }
 
-static void
-_e_hwc_window_queue_destroy(E_Hwc_Window_Queue *queue)
-{
-   E_Hwc_Window_Queue_Buffer *queue_buffer = NULL;
-
-   if (_hwc_winq_mgr)
-     eina_hash_del(_hwc_winq_mgr->hwc_winq_hash, &queue->tqueue, queue);
-
-   EHWQINF("Destroy tq:%p", NULL, queue, queue->tqueue);
-
-   EINA_LIST_FREE(queue->buffers, queue_buffer)
-     _e_hwc_window_queue_buffer_destroy(queue_buffer);
-
-   wl_signal_emit(&queue->destroy_signal, queue);
-
-   E_FREE(queue);
-}
-
 static void
 _e_hwc_window_queue_cb_destroy(tbm_surface_queue_h surface_queue, void *data)
 {
-   E_Hwc_Window_Queue *queue = (E_Hwc_Window_Queue *)data;
-
-   _e_hwc_window_queue_destroy(queue);
+   //TODO: check if the backend delete the tsurface_queue.
+   //      PLEASE Deal with it... if there are pending_users on this queue.
+   //      if the backend deletes the tsurface_queue and
+   //      if there is a pending user at the same equeue(tsurface_queue),
+   //      That means that the backend has the wrong policy at the validation.
 }
 
 static E_Hwc_Window_Queue *