Fix rpc_port_proxy_destroy() function 24/242924/1
authorHwankyu Jhun <h.jhun@samsung.com>
Wed, 2 Sep 2020 03:23:15 +0000 (12:23 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Wed, 2 Sep 2020 03:23:15 +0000 (12:23 +0900)
rpc_port_proxy_destroy() calls DisconnectPort() method to disconnect main port.

Change-Id: Ia86611a4a6442805f94af335a699a105ad285f5e
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
src/proxy-internal.cc
src/proxy-internal.h
src/rpc-port.cc

index 217e974..9adfe88 100644 (file)
@@ -201,7 +201,6 @@ int Proxy::Connect(std::string appid, std::string port_name,
   return RPC_PORT_ERROR_NONE;
 }
 
-// LCOV_EXCL_START
 int Proxy::ConnectSync(std::string appid, std::string port_name,
                        IEventListener* ev) {
   if (ev == nullptr)
@@ -244,7 +243,10 @@ int Proxy::ConnectSync(std::string appid, std::string port_name,
 
   return RPC_PORT_ERROR_NONE;
 }
-// LCOV_EXCL_STOP
+
+void Proxy::DisconnectPort() {
+  main_port_.reset();
+}
 
 void Proxy::SetRealAppId(const std::string& alias_appid) {
   if (!real_appid_.empty())
index 389ad29..5ada809 100644 (file)
@@ -45,6 +45,7 @@ class Proxy : public FdBroker::IEventWatcher {
 
   int Connect(std::string appid, std::string port_name, IEventListener* ev);
   int ConnectSync(std::string appid, std::string port_name, IEventListener* ev);
+  void DisconnectPort();
 
   std::shared_ptr<Port> GetPort() const {
     return main_port_;
index e88f699..81362f6 100644 (file)
@@ -262,7 +262,9 @@ RPC_API int rpc_port_proxy_destroy(rpc_port_proxy_h h) {
     return RPC_PORT_ERROR_INVALID_PARAMETER;
 
   auto p = static_cast<::ProxyExt*>(h);
+  _W("rpc_port_proxy_destroy(%p)", p);
   p->SetDestroying(true);
+  p->DisconnectPort();
 
   g_idle_add_full(G_PRIORITY_HIGH,
       [](gpointer data) -> gboolean {