surface_queue: don`t emit reset if queue doesn't have attached surface 45/183645/3
authorChangyeon Lee <cyeon.lee@samsung.com>
Mon, 9 Jul 2018 10:00:10 +0000 (19:00 +0900)
committerChangyeon Lee <cyeon.lee@samsung.com>
Mon, 9 Jul 2018 10:06:35 +0000 (19:06 +0900)
Change-Id: I33faadc45e91e12a176e002c389ca71f8fac01d8

src/tbm_surface_queue.c

index 1d8cc99..de15fda 100644 (file)
@@ -1760,6 +1760,14 @@ tbm_surface_queue_set_size(tbm_surface_queue_h
        pthread_mutex_lock(&surface_queue->lock);
 
        if (flush) {
+               surface_queue->queue_size = queue_size;
+
+               if (surface_queue->num_attached == 0) {
+                       pthread_mutex_unlock(&surface_queue->lock);
+                       _tbm_surf_queue_mutex_unlock();
+                       return TBM_SURFACE_QUEUE_ERROR_NONE;
+               }
+
                if (surface_queue->modes & TBM_SURFACE_QUEUE_MODE_GUARANTEE_CYCLE) {
                        /* Destory surface and Push to free_queue */
                        LIST_FOR_EACH_ENTRY_SAFE(node, tmp, &surface_queue->free_queue.head, item_link)
@@ -1779,7 +1787,6 @@ tbm_surface_queue_set_size(tbm_surface_queue_h
                _queue_init(&surface_queue->free_queue);
 
                surface_queue->num_attached = 0;
-               surface_queue->queue_size = queue_size;
 
                if (surface_queue->impl && surface_queue->impl->reset)
                        surface_queue->impl->reset(surface_queue);