ApiTester: address a thread sanitizer issue

This commit is contained in:
Vaidas Gasiunas 2022-03-15 14:55:35 +01:00
parent 09bb37ce3e
commit 1a1c157246
1 changed files with 3 additions and 1 deletions

View File

@ -270,6 +270,9 @@ protected:
void onFutureReady(FDBFuture* f) {
injectRandomSleep();
// Hold a reference to this to avoid it to be
// destroyed before releasing the mutex
auto thisRef = shared_from_this();
std::unique_lock<std::mutex> lock(mutex);
auto iter = callbackMap.find(f);
ASSERT(iter != callbackMap.end());
@ -287,7 +290,6 @@ protected:
scheduler->schedule(cbInfo.cont);
return;
}
onError(err);
}