Fix crash issue 77/265477/1
authorHwankyu Jhun <h.jhun@samsung.com>
Wed, 20 Oct 2021 08:50:29 +0000 (17:50 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Wed, 20 Oct 2021 08:50:29 +0000 (17:50 +0900)
While the process is terminating, the DebugPort::Dispose() call causes
SIGSEGV. Because, the context instance already destroyed in that time.
This patch adds a parameter to solve the crash issue. If the do_leave is
false, the method does not close the app com connection.

Change-Id: I69a0471d5a5deaeccab74ed04cb83d445b3f74b9
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
src/debug-port-internal.cc
src/debug-port-internal.hh

index 3d01bcd..9787f96 100644 (file)
@@ -41,7 +41,7 @@ constexpr const char ENDPOINT_RPC_PORT_DEBUG[] = "org.tizen.rpcport.debug";
 constexpr const char KEY_PORT_NAME[] = "__K_PORT_NAME__";
 
 RPC_DTOR void DebugPortDtor() {
-  DebugPort::GetInst()->Dispose();
+  DebugPort::GetInst()->Dispose(false);
 }
 
 }  // namespace
@@ -71,12 +71,12 @@ DebugPort* DebugPort::GetInst() {
   return inst;
 }
 
-void DebugPort::Dispose() {
+void DebugPort::Dispose(bool do_leave) {
   std::lock_guard<std::recursive_mutex> lock(GetMutex());
   if (disposed_)
     return;
 
-  if (conn_) {
+  if (do_leave && conn_) {
     aul_app_com_leave(conn_);
     conn_ = nullptr;
   }
index 1e8718d..e624660 100644 (file)
@@ -78,7 +78,7 @@ class DebugPort {
 
   static DebugPort* GetInst();
 
-  void Dispose();
+  void Dispose(bool do_leave = true);
   bool IsConnected();
 
   void AddSession(std::string port_name, std::string destination,