From: Andrii Grynenko <andrii@fb.com>
Date: Thu, 15 Dec 2016 04:06:38 +0000 (-0800)
Subject: Require runBeforeLoop callbacks to be canceled prior to EventBase destruction
X-Git-Tag: v2016.12.19.00~15
X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=e3f67e10426465a302ab05cc05448f74ebc70e43;p=folly.git

Require runBeforeLoop callbacks to be canceled prior to EventBase destruction

Summary: This makes it similar to other other events registered with EventBase.

Reviewed By: yfeldblum

Differential Revision: D4331277

fbshipit-source-id: 5d728d4ae5faff1a72ed724b4e2a6c0dd6c3b02d
---

diff --git a/folly/io/async/EventBase.cpp b/folly/io/async/EventBase.cpp
index d3eab70c..0f09c695 100644
--- a/folly/io/async/EventBase.cpp
+++ b/folly/io/async/EventBase.cpp
@@ -171,9 +171,7 @@ EventBase::~EventBase() {
 
   clearCobTimeouts();
 
-  while (!runBeforeLoopCallbacks_.empty()) {
-    delete &runBeforeLoopCallbacks_.front();
-  }
+  DCHECK_EQ(0, runBeforeLoopCallbacks_.size());
 
   (void)runLoopCallbacks();