From: Joonbum Ko Date: Mon, 17 Jul 2023 07:35:16 +0000 (+0900) Subject: utils_gthread: do not make data into NULL before the source is destroyed X-Git-Tag: accepted/tizen/unified/20230718.162202~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=027671a01d9be088aa65759758ded4a5e210b106;p=platform%2Fcore%2Fuifw%2Flibtpl-egl.git utils_gthread: do not make data into NULL before the source is destroyed - Even if thread call the g_source_destroy & unref it, it may not be destroyed immediately. (waiting for dispatch in g_main_context) - source->data will be changed to NULL only when it destroyed perfectly. Change-Id: Iecf8ce7599a0ad92346fe7dc802bfcebbb7cd25c Signed-off-by: Joonbum Ko --- diff --git a/src/tpl_utils_gthread.c b/src/tpl_utils_gthread.c index 6020a67..e9f506b 100644 --- a/src/tpl_utils_gthread.c +++ b/src/tpl_utils_gthread.c @@ -327,8 +327,6 @@ __gsource_remove_and_destroy(tpl_gsource *source) g_source_remove_unix_fd(&source->gsource, source->tag); g_source_destroy(&source->gsource); g_source_unref(&source->gsource); - - source->data = NULL; } void @@ -339,7 +337,6 @@ tpl_gsource_destroy(tpl_gsource *source, tpl_bool_t destroy_in_thread) if (g_source_is_destroyed(&source->gsource)) { TPL_WARN("gsource(%p) already has been destroyed.", source); - source->data = NULL; return; } @@ -358,6 +355,16 @@ tpl_gsource_destroy(tpl_gsource *source, tpl_bool_t destroy_in_thread) } if (!destroy_in_thread) { + if (source->fd_type == FD_TYPE_FENCE && + source->type == SOURCE_TYPE_DISPOSABLE) { + TPL_LOG_D("[GSOURCE][DESTROY]", "tpl_gsource(%p) type(%d)", + source, source->type); + + g_source_remove_unix_fd(&source->gsource, source->tag); + source->data = NULL; + g_source_destroy(&source->gsource); + g_source_unref(&source->gsource); + } __gsource_remove_and_destroy(source); }