From: INSUN PYO Date: Thu, 24 Oct 2019 08:32:19 +0000 (+0900) Subject: [ITC][device][Non-ACR][Fix unref timer twice] X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=631c41de4f1a066e938cefb0b6ec3d8dd15fe848;p=test%2Ftct%2Fnative%2Fapi.git [ITC][device][Non-ACR][Fix unref timer twice] For timer that returns false, glib automatically calls unref when timer expires. Change-Id: Iadce6f99f7714661ec9687c6151f4a5b3e88658f (cherry picked from commit 1348b24fb17bf6cff751ccc4c535d76dfb27419a) --- diff --git a/src/itc/device/ITs-device.c b/src/itc/device/ITs-device.c index 3cacf3737..b7715cf19 100755 --- a/src/itc/device/ITs-device.c +++ b/src/itc/device/ITs-device.c @@ -150,6 +150,9 @@ gboolean DeviceTimeout(gpointer data) g_main_loop_unref( g_pDeviceMainLoop ); g_pDeviceMainLoop = NULL; } + + nDeviceTimeoutId = 0; + FPRINTF("[Line : %d][%s] Callback DeviceTimeout\\n", __LINE__, API_NAMESPACE); return false; } @@ -262,8 +265,13 @@ int ITc_device_add_remove_callback_p(void) g_pDeviceMainLoop = g_main_loop_new(NULL, false); nDeviceTimeoutId = g_timeout_add(TIMEOUT_CB, DeviceTimeout, g_pDeviceMainLoop); g_main_loop_run(g_pDeviceMainLoop); - g_source_remove(nDeviceTimeoutId); g_pDeviceMainLoop = NULL; + if (nDeviceTimeoutId) + { + g_source_remove(nDeviceTimeoutId); + nDeviceTimeoutId = 0; + } + if ( g_bDeviceChangedCallback == false ) { @@ -314,8 +322,12 @@ int ITc_device_add_remove_callback_p(void) g_pDeviceMainLoop = g_main_loop_new(NULL, false); nDeviceTimeoutId = g_timeout_add(TIMEOUT_CB, DeviceTimeout, g_pDeviceMainLoop); g_main_loop_run(g_pDeviceMainLoop); - g_source_remove(nDeviceTimeoutId); g_pDeviceMainLoop = NULL; + if (nDeviceTimeoutId) + { + g_source_remove(nDeviceTimeoutId); + nDeviceTimeoutId = 0; + } if ( g_bDeviceChangedCallback == true ) {