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")
|
||||
{
|
||||
#ifdef ANDROID
|
||||
ANativeActivity_finish(global_android_app->activity);
|
||||
#else
|
||||
StateManager::get()->popMenu();
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
else if (selection == "about")
|
||||
@ -564,3 +568,15 @@ void MainMenuScreen::onDisabledItemClicked(const std::string& item)
|
||||
}
|
||||
#endif
|
||||
} // 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 */
|
||||
virtual void onDisabledItemClicked(const std::string& item) OVERRIDE;
|
||||
|
||||
/** \brief implement optional callback from parent
|
||||
* class GUIEngine::Screen */
|
||||
virtual bool onEscapePressed() OVERRIDE;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -252,13 +252,9 @@ void StateManager::onTopMostScreenChanged()
|
||||
|
||||
void StateManager::onStackEmptied()
|
||||
{
|
||||
#ifdef ANDROID
|
||||
ANativeActivity_finish(global_android_app->activity);
|
||||
#else
|
||||
GUIEngine::cleanUp();
|
||||
GUIEngine::deallocate();
|
||||
main_loop->abort();
|
||||
#endif
|
||||
} // onStackEmptied
|
||||
|
||||
// ============================================================================
|
||||
|
Loading…
Reference in New Issue
Block a user