void
_SettingClient::InitSettingClient(void)
{
- static _SettingClient settingManager;
- __pSettingClient = &settingManager;
+ __pSettingClient = new (std::nothrow) _SettingClient();
+ SysTryReturn(NID_SYS, __pSettingClient, , GetLastResult(), "It is failed to create SettingClient by [%s].", GetErrorMessage(GetLastResult()));
+ atexit(DestroySettingClient);
+}
+
+void
+_SettingClient::DestroySettingClient(void)
+{
+ delete __pSettingClient;
}
_SettingClient*
}
_SettingClient::_SettingClient()
- : __subscribed(false)
+ : __pIpcClient(null)
+ , __subscribed(false)
, __subscribedForInternal(false)
, __pListener(null)
, __pSettingEvent(null)
unique_ptr<_SettingEvent> settingEvent(new(nothrow) _SettingEvent());
unique_ptr<_SettingEvent> settingEventForInternal(new(nothrow) _SettingEvent());
+ unique_ptr<_IpcClient> pIpcClient(new (nothrow) _IpcClient());
- __pIpcClient = new (nothrow) _IpcClient();
- r = __pIpcClient->Construct(serviceId, this);
+ r = pIpcClient->Construct(serviceId, this);
SysTryCatch(NID_SYS, r == E_SUCCESS, r = E_SYSTEM, r, "It is failed to construct IPC client.");
r = __asyncEventList.Construct();
SysTryCatch(NID_SYS, r == E_SUCCESS, r = E_SYSTEM, r, "It is failed to construct asyn event list.");
{
__pSettingEvent = settingEvent.release();
__pSettingEventForInternal = settingEventForInternal.release();
+ __pIpcClient = pIpcClient.release();
}
SetLastResult(r);
}