Skip to content

Commit

Permalink
MessageControl: move registration after implementation initalisation
Browse files Browse the repository at this point in the history
  • Loading branch information
bramoosterhuis committed Apr 21, 2022
1 parent 2479474 commit d72fbf9
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions MessageControl/MessageControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -363,8 +363,6 @@ namespace Plugin {

_service = service;
_service->AddRef();
_service->Register(&_observer);
_service->Register(&_comSink);

Config config;
config.FromString(service->ConfigLine());
Expand All @@ -376,6 +374,10 @@ namespace Plugin {
message = _T("MessageControl plugin could not be instantiated.");
} else {
RegisterAll();

_service->Register(&_observer);
_service->Register(&_comSink);

if (_control->Configure(service->Background(),
config.Abbreviated.Value(),
config.Console.Value(),
Expand All @@ -402,11 +404,12 @@ namespace Plugin {
{
ASSERT(service == _service);

service->Unregister(&_observer);
service->Unregister(&_comSink);

if (_control != nullptr) {
UnregisterAll();

service->Unregister(&_observer);
service->Unregister(&_comSink);

_control->UnregisterOutputNotification(&_outputNotification);
_webSocketExporter.reset();

Expand Down

0 comments on commit d72fbf9

Please sign in to comment.