fix mem leak
[folly.git] / folly / io / async / EventBase.cpp
index a3e5bdc92fd96b6b4bcd133e0f728d908310f069..d901650650fd59e6f70dd17dbd03f7de9e8fa844 100644 (file)
@@ -521,7 +521,7 @@ void EventBase::runInLoop(Cob&& cob, bool thisIteration) {
 }
 
 void EventBase::runOnDestruction(LoopCallback* callback) {
-  DCHECK(isInEventBaseThread());
+  std::lock_guard<std::mutex> lg(onDestructionCallbacksMutex_);
   callback->cancelLoopCallback();
   onDestructionCallbacks_.push_back(*callback);
 }