Skip to content

Commit

Permalink
Correct the Detach and Notify order in Server::Service::Deactivate() (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
VeithMetro authored Sep 26, 2024
1 parent 257d635 commit aaf530c
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions Source/Thunder/PluginServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -581,26 +581,28 @@ namespace PluginHost {

Lock();

if (_jsonrpc != nullptr) {
PluginHost::IShell::IConnectionServer::INotification* sink = nullptr;
_jsonrpc->Detach(sink);
if (sink != nullptr) {
Unregister(sink);
sink->Release();
}
if (currentState != IShell::state::ACTIVATION) {
SYSLOG(Logging::Shutdown, (_T("Deactivated plugin [%s]:[%s]"), className.c_str(), callSign.c_str()));

#ifdef THUNDER_RESTFULL_API
Notify(EMPTY_STRING, string(_T("{\"state\":\"deactivated\",\"reason\":\"")) + textReason.Data() + _T("\"}"));
#endif
Notify(_T("statechange"), string(_T("{\"state\":\"deactivated\",\"reason\":\"")) + textReason.Data() + _T("\"}"));
}

if (_external.Connector().empty() == false) {
_external.Close(0);
}

if (currentState != IShell::state::ACTIVATION) {
SYSLOG(Logging::Shutdown, (_T("Deactivated plugin [%s]:[%s]"), className.c_str(), callSign.c_str()));
if (_jsonrpc != nullptr) {
PluginHost::IShell::IConnectionServer::INotification* sink = nullptr;

#ifdef THUNDER_RESTFULL_API
Notify(EMPTY_STRING, string(_T("{\"state\":\"deactivated\",\"reason\":\"")) + textReason.Data() + _T("\"}"));
#endif
Notify(_T("statechange"), string(_T("{\"state\":\"deactivated\",\"reason\":\"")) + textReason.Data() + _T("\"}"));
_jsonrpc->Detach(sink);

if (sink != nullptr) {
Unregister(sink);
sink->Release();
}
}
}

Expand Down

0 comments on commit aaf530c

Please sign in to comment.