From: Hwankyu Jhun Date: Thu, 26 Jan 2023 03:39:02 +0000 (+0000) Subject: Revert "Check current thread ID to destroy handle" X-Git-Tag: accepted/tizen/unified/20230130.165639~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d234a22cc5bc83726fb5d496ef81851a51c6adad;p=platform%2Fcore%2Fappfw%2Frpc-port.git Revert "Check current thread ID to destroy handle" This reverts commit 2da1742b97e33d2b9c42d01104080721143d8b59. When calling the event callback function, app developer releases the handle in the callback function. It makes a crash issue. Even if the destroy function is called in the main thread, the rpc-port library doesn't release the handle immediately to prevent the issue. Change-Id: I58a25d9e4c5f1f42065901dac8e6a30f22f898d2 Signed-off-by: Hwankyu Jhun --- diff --git a/src/rpc-port.cc b/src/rpc-port.cc index 88799b0..1a09c2c 100644 --- a/src/rpc-port.cc +++ b/src/rpc-port.cc @@ -17,8 +17,6 @@ #include #include #include -#include -#include #include #include @@ -303,13 +301,9 @@ RPC_API int rpc_port_proxy_destroy(rpc_port_proxy_h h) { } _W("rpc_port_proxy_destroy(%p)", proxy); - if (getpid() == gettid()) { - delete p; - return RPC_PORT_ERROR_NONE; - } - proxy->SetDestroying(true); proxy->DisconnectPort(); + g_idle_add_full(G_PRIORITY_HIGH, [](gpointer data) -> gboolean { auto p = static_cast*>(data); @@ -317,7 +311,6 @@ RPC_API int rpc_port_proxy_destroy(rpc_port_proxy_h h) { delete p; return G_SOURCE_REMOVE; }, h, nullptr); - return RPC_PORT_ERROR_NONE; } @@ -446,11 +439,6 @@ RPC_API int rpc_port_stub_destroy(rpc_port_stub_h h) { p->SetDestroying(true); aul_rpc_port_usr_destroy(p->GetPortName().c_str(), rpc_port_get_target_uid()); - if (getpid() == gettid()) { - delete p; - return RPC_PORT_ERROR_NONE; - } - p->Ignore(); g_idle_add_full(G_PRIORITY_HIGH, [](gpointer data) -> gboolean { @@ -459,7 +447,6 @@ RPC_API int rpc_port_stub_destroy(rpc_port_stub_h h) { delete p; return G_SOURCE_REMOVE; }, h, nullptr); - return RPC_PORT_ERROR_NONE; }