From 90a9e4ea771cd67486855820a196dd0580f6d90b Mon Sep 17 00:00:00 2001 From: Hyunho Kang Date: Wed, 19 Jul 2017 09:41:19 +0900 Subject: [PATCH] Do not unref tbm_surface when receive same buffer Change-Id: I09f3e6f72bd1944a19866977a6f9586a7b236b09 Signed-off-by: Hyunho Kang --- .../src/screen_connector_toolkit_evas.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/screen_connector_watcher_evas/src/screen_connector_toolkit_evas.c b/screen_connector_watcher_evas/src/screen_connector_toolkit_evas.c index d0b12dd..8c2342b 100644 --- a/screen_connector_watcher_evas/src/screen_connector_toolkit_evas.c +++ b/screen_connector_watcher_evas/src/screen_connector_toolkit_evas.c @@ -132,6 +132,9 @@ static void __destroy_cur_buffer(gpointer data) if (!info) return; + if (info->cur_buffer) + wl_buffer_destroy(info->cur_buffer); + free(info); } @@ -603,6 +606,7 @@ static void __toolkit_update_cb(struct tizen_remote_surface *trs, uint32_t type, char plug_id[256]; screen_connector_toolkit_evas_h toolkit_evas_h; cur_buffer_info_h c_buf_info; + bool duplicate_buffer = false; toolkit_evas_h = (screen_connector_toolkit_evas_h)data; if (toolkit_evas_h->img_tbm == NULL) { @@ -685,15 +689,11 @@ static void __toolkit_update_cb(struct tizen_remote_surface *trs, uint32_t type, if (tizen_remote_surface_get_version(trs) >= TIZEN_REMOTE_SURFACE_RELEASE_SINCE_VERSION) { c_buf_info = g_hash_table_lookup(__cur_buffer_table, toolkit_evas_h->cur_buffer); if (c_buf_info != NULL) { - struct wl_buffer *tmp_buffer = c_buf_info->cur_buffer; - if (__cur_buffer_info_unref(trs, c_buf_info)) { - if(tmp_buffer != NULL) { - if (tmp_buffer != tbm) { - wl_buffer_destroy(tmp_buffer); - } else { - LOGE("Same buffer %p", tmp_buffer); - } - } + if (c_buf_info->cur_buffer != tbm) { + __cur_buffer_info_unref(trs, c_buf_info); + } else { + duplicate_buffer = true; + LOGW("Same buffer %p", tbm); } } } @@ -707,7 +707,8 @@ static void __toolkit_update_cb(struct tizen_remote_surface *trs, uint32_t type, __cur_buffer_info_ref(c_buf_info); g_hash_table_insert(__cur_buffer_table, toolkit_evas_h->cur_buffer, c_buf_info); } else { - __cur_buffer_info_ref(c_buf_info); + if (!duplicate_buffer) + __cur_buffer_info_ref(c_buf_info); } if (is_added) { -- 2.7.4