Modify aul_app_event_destroy() function
authorHwankyu Jhun <h.jhun@samsung.com>
Thu, 9 Mar 2023 23:12:15 +0000 (23:12 +0000)
committerHwankyu Jhun <h.jhun@samsung.com>
Fri, 10 Mar 2023 01:02:02 +0000 (01:02 +0000)
If the caller thread ID is equal to the caller process ID,
the function releases the handle immediately. If it's not,
the function uses glib idler to avoid thread safe issues.

Change-Id: Id8272fb15be06459bab153932c4e1c0a9115fbf6
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
aul/api/aul_app_event.cc

index 9ff717f010e85fbbd96fd2e3cc13f14709293591..1b1e94c3d1e3089d889f3d7fc2ae427dd868a741 100644 (file)
@@ -17,6 +17,8 @@
 #include "aul/api/aul_app_event.h"
 
 #include <glib.h>
+#include <sys/types.h>
+#include <unistd.h>
 
 #include <string>
 #include <utility>
@@ -137,6 +139,10 @@ extern "C" API int aul_app_event_destroy(aul_app_event_h app_event) {
   }
 
   auto* handle = static_cast<AppEventStub*>(app_event);
-  handle->Dispose();
+  if (getpid() == gettid())
+    delete handle;
+  else
+    handle->Dispose();
+
   return AUL_R_OK;
 }