File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -169,17 +169,26 @@ class Launcher : public PluginHost::IPlugin {
169
169
170
170
public:
171
171
void Register (IProcessState* observer) {
172
+ ASSERT (observer != nullptr );
173
+
172
174
_adminLock.Lock ();
173
- ASSERT (std::find (_callbacks.begin (), _callbacks.end (), observer) == _callbacks.end ());
175
+ auto found = std::find (_callbacks.begin (), _callbacks.end (), observer);
176
+ ASSERT (found == _callbacks.end ());
177
+
174
178
if (_callbacks.empty ()) {
175
179
const bool opened = Open ();
176
180
DEBUG_VARIABLE (opened);
177
181
ASSERT (opened);
178
182
}
179
- _callbacks.push_back (observer);
183
+ if (found == _callbacks.end ()) {
184
+ _callbacks.push_back (observer);
185
+ }
186
+
180
187
_adminLock.Unlock ();
181
188
}
182
189
void Unregister (IProcessState* observer) {
190
+ ASSERT (observer != nullptr );
191
+
183
192
_adminLock.Lock ();
184
193
auto found = std::find (_callbacks.begin (), _callbacks.end (), observer);
185
194
ASSERT (found != _callbacks.end ());
You can’t perform that action at this time.
0 commit comments