From f3e6e8331afae5fe5ca038f7afc686fe02c198c7 Mon Sep 17 00:00:00 2001 From: James Chen Date: Thu, 7 Apr 2016 15:50:59 +0800 Subject: [PATCH] Fixes wrong usage of std::vector's constructor in EventDispatcher::removeAllEventListener. --- cocos/base/CCEventDispatcher.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cocos/base/CCEventDispatcher.cpp b/cocos/base/CCEventDispatcher.cpp index 8ee77b7766..9be52d8bfc 100644 --- a/cocos/base/CCEventDispatcher.cpp +++ b/cocos/base/CCEventDispatcher.cpp @@ -1484,7 +1484,8 @@ void EventDispatcher::removeCustomEventListeners(const std::string& customEventN void EventDispatcher::removeAllEventListeners() { bool cleanMap = true; - std::vector types(_listenerMap.size()); + std::vector types; + types.reserve(_listenerMap.size()); for (const auto& e : _listenerMap) {