tbm_surface : delete user data before bo unref 50/81650/2
authorChangyeon Lee <cyeon.lee@samsung.com>
Wed, 27 Jul 2016 10:57:45 +0000 (19:57 +0900)
committerChangyeon Lee <cyeon.lee@samsung.com>
Wed, 27 Jul 2016 10:57:49 +0000 (19:57 +0900)
Change-Id: If88d0cc1ff2f40b2fef570d16b0b0f1c7a9d39d1

src/tbm_surface_internal.c

index dbdf5f9..b94053a 100644 (file)
@@ -271,13 +271,6 @@ _tbm_surface_internal_destroy(tbm_surface_h surface)
        tbm_bufmgr bufmgr = surface->bufmgr;
        tbm_user_data *old_data = NULL, *tmp = NULL;
 
-       for (i = 0; i < surface->num_bos; i++) {
-               surface->bos[i]->surface = NULL;
-
-               tbm_bo_unref(surface->bos[i]);
-               surface->bos[i] = NULL;
-       }
-
        /* destory the user_data_list */
        if (!LIST_IS_EMPTY(&surface->user_data_list)) {
                LIST_FOR_EACH_ENTRY_SAFE(old_data, tmp, &surface->user_data_list, item_link) {
@@ -286,6 +279,13 @@ _tbm_surface_internal_destroy(tbm_surface_h surface)
                }
        }
 
+       for (i = 0; i < surface->num_bos; i++) {
+               surface->bos[i]->surface = NULL;
+
+               tbm_bo_unref(surface->bos[i]);
+               surface->bos[i] = NULL;
+       }
+
        LIST_DEL(&surface->item_link);
 
        free(surface);