Fix android exit crash
This commit is contained in:
parent
d8a9accba3
commit
b03af63ab7
@ -405,7 +405,11 @@ void MainMenuScreen::eventCallback(Widget* widget, const std::string& name,
|
|||||||
}
|
}
|
||||||
else if (selection == "quit")
|
else if (selection == "quit")
|
||||||
{
|
{
|
||||||
|
#ifdef ANDROID
|
||||||
|
ANativeActivity_finish(global_android_app->activity);
|
||||||
|
#else
|
||||||
StateManager::get()->popMenu();
|
StateManager::get()->popMenu();
|
||||||
|
#endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (selection == "about")
|
else if (selection == "about")
|
||||||
@ -564,3 +568,15 @@ void MainMenuScreen::onDisabledItemClicked(const std::string& item)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
} // onDisabledItemClicked
|
} // onDisabledItemClicked
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
bool MainMenuScreen::onEscapePressed()
|
||||||
|
{
|
||||||
|
#ifdef ANDROID
|
||||||
|
ANativeActivity_finish(global_android_app->activity);
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return true;
|
||||||
|
} // onEscapePressed
|
||||||
|
@ -58,6 +58,10 @@ public:
|
|||||||
|
|
||||||
/** \brief implement callback from parent class GUIEngine::Screen */
|
/** \brief implement callback from parent class GUIEngine::Screen */
|
||||||
virtual void onDisabledItemClicked(const std::string& item) OVERRIDE;
|
virtual void onDisabledItemClicked(const std::string& item) OVERRIDE;
|
||||||
|
|
||||||
|
/** \brief implement optional callback from parent
|
||||||
|
* class GUIEngine::Screen */
|
||||||
|
virtual bool onEscapePressed() OVERRIDE;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -252,13 +252,9 @@ void StateManager::onTopMostScreenChanged()
|
|||||||
|
|
||||||
void StateManager::onStackEmptied()
|
void StateManager::onStackEmptied()
|
||||||
{
|
{
|
||||||
#ifdef ANDROID
|
|
||||||
ANativeActivity_finish(global_android_app->activity);
|
|
||||||
#else
|
|
||||||
GUIEngine::cleanUp();
|
GUIEngine::cleanUp();
|
||||||
GUIEngine::deallocate();
|
GUIEngine::deallocate();
|
||||||
main_loop->abort();
|
main_loop->abort();
|
||||||
#endif
|
|
||||||
} // onStackEmptied
|
} // onStackEmptied
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
|
Loading…
Reference in New Issue
Block a user