Check GSource status 04/313904/1
authorHwankyu Jhun <h.jhun@samsung.com>
Wed, 3 Jul 2024 07:44:46 +0000 (16:44 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Wed, 3 Jul 2024 07:44:46 +0000 (16:44 +0900)
Before calling g_source_destroy(), the aul library checks whether the source
is destroyed or not. If it's already destroyed, we do not call g_source_destroy().

Change-Id: Ied8e2462556f470e1c077b2dd6c612c142831b47
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
src/aul/anr_monitor.cc

index 54266b19e47b6ee07acd5ccc2e907df3b4f39f9b..dcacd016424586dfe9d731ed560f96fee777eea6 100644 (file)
@@ -154,10 +154,13 @@ gboolean AnrMonitor::TimeoutCb(gpointer user_data) {
   std::lock_guard<std::recursive_mutex> lock(self->GetRecMutex());
   auto* idle_source = self->GetIdleSource();
   if (idle_source != nullptr) {
-    _E("[ANR] The main thread is unable to enter idle state. ");
+    _E("[ANR] The main thread is unable to enter idle state.");
     _E("[ANR] Please modify the implementation so that the main loop does not "
        "create a block state.");
-    g_source_destroy(idle_source);
+    if (!g_source_is_destroyed(idle_source))
+      g_source_destroy(idle_source);
+
+    anr_monitor.SetIdleSource(nullptr);
   }
 
   anr_monitor.AddIdlerToDefaultContext();