Require runBeforeLoop callbacks to be canceled prior to EventBase destruction
authorAndrii Grynenko <andrii@fb.com>
Thu, 15 Dec 2016 04:06:38 +0000 (20:06 -0800)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Thu, 15 Dec 2016 04:18:12 +0000 (20:18 -0800)
Summary: This makes it similar to other other events registered with EventBase.

Reviewed By: yfeldblum

Differential Revision: D4331277

fbshipit-source-id: 5d728d4ae5faff1a72ed724b4e2a6c0dd6c3b02d

folly/io/async/EventBase.cpp

index d3eab70c4fa303b62276967474953b3295ae762f..0f09c69531b2759301d297886722a2fa2f561746 100644 (file)
@@ -171,9 +171,7 @@ EventBase::~EventBase() {
 
   clearCobTimeouts();
 
-  while (!runBeforeLoopCallbacks_.empty()) {
-    delete &runBeforeLoopCallbacks_.front();
-  }
+  DCHECK_EQ(0, runBeforeLoopCallbacks_.size());
 
   (void)runLoopCallbacks();