We are migrating issue tracker of Cocos2d-x Project to Github, please create new issue there. Thanks.
Enable and disable touch more times in touch handler call back function may cause memory leak
Enable and disable touch more times in touch handler call back function may cause memory leak
- File HelloWorldScene.cpp added
- File HelloWorldScene.h added
- Project changed from cocos2d-x to cpp
- Category deleted (
5) - Target version deleted (
cocos2d-1.0.1-x-0.11.0)
I think it is better to check the touch priority before do this optimize.
this is my modify code:
`void CCTouchDispatcher::addStandardDelegate(CCTouchDelegate *pDelegate, int nPriority)
{
CCTouchHandler *pHandler = CCStandardTouchHandler::handlerWithDelegate(pDelegate, nPriority);
if (! m_bLocked)
{
forceAddHandler(pHandler, m_pStandardHandlers);
}
else
{
if (ccCArrayContainsValue(m_pHandlersToRemove, pDelegate))
{
CCTouchHandler *pOldHandler = findHandler(pDelegate);
if (pOldHandler && pOldHandler->getPriority() == nPriority) { ccCArrayRemoveValue(m_pHandlersToRemove, pDelegate); return; } } m_pHandlersToAdd->addObject(pHandler); m_bToAdd = true; }
}
`
Pokerstar88.com Agen Texas Poker Dan Domino Online Indonesia Terpercaya
OK, I’ve updated the announcement and added a link to zipball on google code. Thank you for reminding me.
Agen Indonesia | Agen Bola | Poker Indonesia
The optimization introduces a bug where the priority and Touch Mode will not get changed if the list is locked.
The most straight forward fix is to merge the pHandlersToAdd and pHandlersToRemove into a queue and process through all of them in the order they are received
Pokerstar88.com Agen Texas Poker dan Domino Online Indonesia Terpercaya | Agen Bola | Taruhan Bola | Agen Bola | Olb365.com Agen Judi Bola Online, Agen Judi Casino Online Indonesia Terpercaya
Status: | Closed | |
---|---|---|
Start date: | 2011-10-17 | |
Priority: | Normal | |
Due date: | ||
Assignee: | zhangxm | |
% Done: | 100% |
|
Category: | - | |
Target version: | - |
Replace HelloWorld/Classes with pasted files, and run HelloWorld. menu2 will response the touch event even it is disabled.
The reason is, the add/remove operation is done in menu call back function, then touch delegate(menu2) will be added into
CCTouchDispatcher::m_pHandlersToAdd andCCTouchDispatcher:: m_pHandlersToRemove.
After the returning from menu call back function, CCTouchDispatcher::touches() will add/remove touch delegate contained in
CCTouchDispatcher::m_pHandlersToAdd andCCTouchDispatcher:: m_pHandlersToRemove into CCTouchDispatcher::m_pStandardHandlers
and CCTouchDispatcher::m_pTargetedHandlers.
Because the move operation is done before add, so the touch delegate will be added no matter if it is removed after adding.
The solution is:
change
into
change
into
HelloWorldScene.cpp (2.6 kB) zhangxm, 2011-10-17 23:24
HelloWorldScene.h (805 Bytes) zhangxm, 2011-10-17 23:24