server: null set wl_tbm of queue_ifo when wl_tbm is freed 39/121239/2 accepted/tizen_common accepted/tizen_ivi accepted/tizen_mobile accepted/tizen_tv accepted/tizen_wearable accepted/tizen/common/20170331.152512 accepted/tizen/ivi/20170329.034204 accepted/tizen/mobile/20170329.033952 accepted/tizen/tv/20170329.034113 accepted/tizen/unified/20170329.034227 accepted/tizen/wearable/20170329.034137 submit/tizen/20170328.072410
authorChangyeon Lee <cyeon.lee@samsung.com>
Mon, 27 Mar 2017 09:28:37 +0000 (18:28 +0900)
committerChangyeon Lee <cyeon.lee@samsung.com>
Mon, 27 Mar 2017 10:02:41 +0000 (19:02 +0900)
Change-Id: Ib49c67e7ecfc1cc986c44bb76ad59db62c8da604

src/wayland-tbm-server.c

index 77a519b..ca406e2 100644 (file)
@@ -605,6 +605,7 @@ static void
 _wayland_tbm_server_destroy_resource(struct wl_resource *wl_tbm)
 {
        struct wayland_tbm_server *tbm_srv;
+       struct wayland_tbm_client_queue *cqueue = NULL;
 
 #ifdef DEBUG_TRACE
        pid_t pid;
@@ -620,6 +621,11 @@ _wayland_tbm_server_destroy_resource(struct wl_resource *wl_tbm)
        if (!tbm_srv)
                return;
 
+       wl_list_for_each(cqueue, &tbm_srv->cqueue_list, link) {
+               if (cqueue && cqueue->wl_tbm == wl_tbm)
+                       cqueue->wl_tbm = NULL;
+       }
+
        /* remove the queue resources */
        // TODO:
 }
@@ -1167,7 +1173,7 @@ wayland_tbm_server_client_queue_get(struct wayland_tbm_server *tbm_srv, struct w
        WL_TBM_RETURN_VAL_IF_FAIL(wl_surface != NULL, NULL);
 
        wl_list_for_each(cqueue, &tbm_srv->cqueue_list, link) {
-               if (cqueue && cqueue->wl_surface == wl_surface)
+               if (cqueue && cqueue->wl_tbm && cqueue->wl_surface == wl_surface)
                        return cqueue;
        }
 
@@ -1244,6 +1250,7 @@ wayland_tbm_server_client_queue_export_buffer(
 
        WL_TBM_RETURN_VAL_IF_FAIL(cqueue != NULL, NULL);
        WL_TBM_RETURN_VAL_IF_FAIL(cqueue->wl_tbm_queue != NULL, NULL);
+       WL_TBM_RETURN_VAL_IF_FAIL(cqueue->wl_tbm != NULL, NULL);
        WL_TBM_RETURN_VAL_IF_FAIL(surface != NULL, NULL);
 
        wl_tbm = cqueue->wl_tbm;