Hello,
I found strange behaviour.
I have mapped back buttons on HW back key. And there is difference between call from touch and from keypress.
So if I call buttonAction() from touch after “(m_pListener~~>*m_pfnSelector);” is m_functionName still valid.
But if I call the same action from HW key getNodeByTag)~~>activate() m_functionName has bad ptr.
In win game still run, but on android crash.
void CCMenuItem::activate()
{
if (m_bIsEnabled)
{
if (m_pListener && m_pfnSelector)
{
(m_pListener->*m_pfnSelector)(this);
}
if (m_functionName.size() && CCScriptEngineManager::sharedScriptEngineManager()->getScriptEngine())
{
CCScriptEngineManager::sharedScriptEngineManager()->getScriptEngine()->executeCallFuncN(m_functionName.c_str(), this);
}
}
}
void Game::buttonAction(CCObject* pSender)
{
CCNode* node = (CCNode*) pSender;
this->removeChild(node->getParent()->getParent(), true);
}