fixup! Fix the svace and coverity issue 21/316721/4 accepted/tizen/unified/20240828.164019 accepted/tizen/unified/dev/20240829.043830 accepted/tizen/unified/x/20240829.020343
authorYoungHun Kim <yh8004.kim@samsung.com>
Tue, 27 Aug 2024 08:23:43 +0000 (17:23 +0900)
committerYoungHun Kim <yh8004.kim@samsung.com>
Tue, 27 Aug 2024 22:58:43 +0000 (07:58 +0900)
Change-Id: Id5e9d965e554a85c5efc422e997c43df7eb934dd

packaging/resource-manager.spec
src/rm_callback.cpp
ut/testcase/ut_main.cpp

index ec83557227e54a6cd35f2dcc37ead4136c2e9548..6e741318a499d68efc53d822ec191042de45741c 100644 (file)
@@ -1,7 +1,7 @@
 Name:       resource-manager
 Summary:    Resource manager
 Version:    0.1
-Release:    2
+Release:    3
 Group:      Multimedia/Libraries
 License:    Apache-2.0
 Source0:    %{name}-%{version}.tar.gz
index 75a2cf50ceb8cb07190c4d79a8d3106a08ac6626..385d130ae164a03187bb12e8866b210a2316b42b 100644 (file)
@@ -61,6 +61,7 @@ static pthread_mutex_t rm_cb_mutex = PTHREAD_MUTEX_INITIALIZER;
 
 static GMainLoop *rm_client_loop = NULL;
 static GMainContext *rm_client_context = NULL;
+static GThread *rm_thrd = NULL;
 
 static void rm_add_main_loop(GMainLoop *loop)
 {
@@ -86,6 +87,8 @@ static gpointer rm_run_loop(gpointer data)
        if (main_loop != NULL)
                g_main_loop_run(main_loop);
 
+       g_thread_join(rm_thrd);
+
        RM_INFO("RM client thread finished");
        return NULL;
 }
@@ -100,7 +103,7 @@ int _create_event_loop(void)
        GMainLoop *main_loop = g_main_loop_new(rm_client_ctx, FALSE);
        rm_add_main_loop(main_loop);
 
-       GThread *rm_thrd = g_thread_new("rm_client", rm_run_loop, NULL);
+       rm_thrd = g_thread_new("rm_client", rm_run_loop, NULL);
 
        if (rm_thrd == NULL) {
                // LCOV_EXCL_START
index 8a5d5d53e7fa6af77a553b70c8a4d8d92085b8c8..23876a3fcb2427b5f38605c2d80cae7fac3781ba 100644 (file)
@@ -45,7 +45,7 @@ GTEST_API_ int main(int argc, char **argv)
 
        //GMainContext *context = g_main_context_new();
        g_main_loop = g_main_loop_new(NULL, FALSE);
-       GThread *cb_thread = g_thread_new("rc_cb_thread", tc_run_loop, g_main_loop);
+       g_autoptr(GThread) cb_thread = g_thread_new("rc_cb_thread", tc_run_loop, g_main_loop);
 
        if (cb_thread == NULL) {
                g_main_loop_unref(g_main_loop);