From 8c754ee5a97c3c415fed81461c5520fb8bf0c7d5 Mon Sep 17 00:00:00 2001 From: Ming Date: Wed, 4 Aug 2010 03:10:55 +0000 Subject: [PATCH] issue #26: because it use some macro that using malloc and free, so we can not change it to new --- cocos2dx/CCScheduler.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/cocos2dx/CCScheduler.cpp b/cocos2dx/CCScheduler.cpp index 7d6a45586e..44e27c1a43 100644 --- a/cocos2dx/CCScheduler.cpp +++ b/cocos2dx/CCScheduler.cpp @@ -202,7 +202,7 @@ void CCScheduler::scheduleSelector(SEL_SCHEDULE pfnSelector, SelectorProtocol *p if (! pElement) { - pElement = new tHashSelectorEntry; + pElement = (tHashSelectorEntry *)calloc(sizeof(*pElement), 1);; pElement->target = pTarget; HASH_ADD_INT(m_pHashForSelectors, target, pElement); @@ -287,7 +287,7 @@ void CCScheduler::unscheduleSelector(SEL_SCHEDULE pfnSelector, SelectorProtocol void CCScheduler::priorityIn(tListEntry **ppList, SelectorProtocol *pTarget, int nPriority, bool bPaused) { - tListEntry *pListElement = new tListEntry; + tListEntry *pListElement = (tListEntry *)malloc(sizeof(*pListElement)); pListElement->target = pTarget; pListElement->priority = nPriority; @@ -334,7 +334,7 @@ void CCScheduler::priorityIn(tListEntry **ppList, SelectorProtocol *pTarget, int } // update hash entry for quick access - tHashUpdateEntry *pHashElement = new tHashUpdateEntry(); + tHashUpdateEntry *pHashElement = (tHashUpdateEntry *)calloc(sizeof(*pHashElement), 1); pHashElement->target = pTarget; pHashElement->list = ppList; pHashElement->entry = pListElement; @@ -343,7 +343,8 @@ void CCScheduler::priorityIn(tListEntry **ppList, SelectorProtocol *pTarget, int void CCScheduler::appendIn(_listEntry **ppList, SelectorProtocol *pTarget, bool bPaused) { - tListEntry *pListElement = new tListEntry; + tListEntry *pListElement = (tListEntry *)malloc(sizeof(*pListElement)); +; pListElement->target = pTarget; pListElement->paused = bPaused;