From db05421930ab898062568b4a5f1ff5ba8e0c27b3 Mon Sep 17 00:00:00 2001 From: badlogic Date: Mon, 18 Jul 2016 16:19:55 +0200 Subject: [PATCH] [cocos2dx] Closes #605, crash on iOS when system UI is triggered. --- spine-cocos2dx/src/spine/SkeletonBatch.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/spine-cocos2dx/src/spine/SkeletonBatch.cpp b/spine-cocos2dx/src/spine/SkeletonBatch.cpp index d5e5ddcc0..5dcd621b0 100644 --- a/spine-cocos2dx/src/spine/SkeletonBatch.cpp +++ b/spine-cocos2dx/src/spine/SkeletonBatch.cpp @@ -34,6 +34,7 @@ #include USING_NS_CC; +#define EVENT_AFTER_DRAW_RESET_POSITION "director_after_draw" using std::max; namespace spine { @@ -57,11 +58,13 @@ SkeletonBatch::SkeletonBatch (int capacity) : _firstCommand = new Command(); _command = _firstCommand; - Director::getInstance()->getScheduler()->scheduleUpdate(this, -1, false); + Director::getInstance()->getEventDispatcher()->addCustomEventListener(EVENT_AFTER_DRAW_RESET_POSITION, [this](EventCustom* eventCustom){ + this->update(0); + });; } SkeletonBatch::~SkeletonBatch () { - Director::getInstance()->getScheduler()->unscheduleUpdate(this); + Director::getInstance()->getEventDispatcher()->removeCustomEventListeners(EVENT_AFTER_DRAW_RESET_POSITION); Command* command = _firstCommand; while (command) {