Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions Launcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -169,17 +169,26 @@ class Launcher : public PluginHost::IPlugin {

public:
void Register(IProcessState* observer) {
ASSERT(observer != nullptr);

_adminLock.Lock();
ASSERT (std::find(_callbacks.begin(), _callbacks.end(), observer) == _callbacks.end());
auto found = std::find(_callbacks.begin(), _callbacks.end(), observer);
ASSERT (found == _callbacks.end());

if (_callbacks.empty()) {
const bool opened = Open();
DEBUG_VARIABLE(opened);
ASSERT(opened);
}
_callbacks.push_back(observer);
if (found == _callbacks.end()) {
_callbacks.push_back(observer);
}

_adminLock.Unlock();
}
void Unregister(IProcessState* observer) {
ASSERT(observer != nullptr);

_adminLock.Lock();
auto found = std::find(_callbacks.begin(), _callbacks.end(), observer);
ASSERT(found != _callbacks.end());
Expand Down