New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android: Crash when quitting the game while a battle is running #1298

Closed
Ghabry opened this Issue Oct 28, 2017 · 1 comment

Comments

Projects
None yet
2 participants
@Ghabry
Member

Ghabry commented Oct 28, 2017

Caused by

Main_Data::game_party->GetBattlers(allies);

Which means that Main_Data::game_party is invalid. The only place where this can happen is

Player/src/main_data.cpp

Lines 166 to 172 in 7eb998f

void Main_Data::Cleanup() {
Game_Map::Quit();
Game_Actors::Dispose();
game_screen.reset();
game_player.reset();
game_party.reset();

Which is triggered by

Player/src/scene_map.cpp

Lines 63 to 65 in 7eb998f

Scene_Map::~Scene_Map() {
Main_Data::Cleanup();
}

Which is triggered by

Player/src/player.cpp

Lines 222 to 227 in 7eb998f

void Player::MainLoop() {
Scene::instance->MainFunction();
for (size_t i = 0; i < Scene::old_instances.size(); ++i) {
Graphics::Pop();
}
Scene::old_instances.clear();

So this will crash when Scene_Map is destructed before Scene_Battle when the scene vector is cleared. Possible solution: Move the Main_Data::Cleanup() call into Player::Quit.

Stack trace

Stack frame #00 pc 00000000001a2cfa  /data/app/org.easyrpg.player-1/lib/arm/libmain.so (_ZN11Game_Battle4QuitEv+121): Routine Game_Battle::Quit() at /var/lib/jenkins/workspace/player-android/builds/android/app/src/main/jni/src/../../../../../../..//src/game_battle.cpp:94
Stack frame #01 pc 00000000002243ad  /data/app/org.easyrpg.player-1/lib/arm/libmain.so (_ZN12Scene_BattleD2Ev+20): Routine ~Scene_Battle at /var/lib/jenkins/workspace/player-android/builds/android/app/src/main/jni/src/../../../../../../..//src/scene_battle.cpp:50
Stack frame #02 pc 00000000004a52b1  /data/app/org.easyrpg.player-1/lib/arm/libmain.so (_ZNSt6__ndk119__shared_weak_count16__release_sharedEv+44): Routine std::__ndk1::__shared_count::__release_shared() at /usr/local/google/buildbot/src/android/ndk-r15-release/external/libcxx/src/memory.cpp:67
Stack frame #03 pc 00000000001d62fb  /data/app/org.easyrpg.player-1/lib/arm/libmain.so (_ZN6Player8MainLoopEv+90): Routine ~shared_ptr at /var/lib/jenkins/workspace/toolchain-android/android/android-ndk-r15c/sources/cxx-stl/llvm-libc++/include/memory:4600
Stack frame #04 pc 00000000001d6175  /data/app/org.easyrpg.player-1/lib/arm/libmain.so (_ZN6Player3RunEv+268): Routine Player::Run() at /var/lib/jenkins/workspace/player-android/builds/android/app/src/main/jni/src/../../../../../../..//src/player.cpp:218
Stack frame #05 pc 00000000001c9293  /data/app/org.easyrpg.player-1/lib/arm/libmain.so (SDL_main+8): Routine SDL_main at /var/lib/jenkins/workspace/player-android/builds/android/app/src/main/jni/src/../../../../../../..//src/main.cpp:28

@Ghabry Ghabry added this to the 0.5.4 milestone Oct 28, 2017

carstene1ns added a commit that referenced this issue Oct 29, 2017

@Ghabry

This comment has been minimized.

Member

Ghabry commented Jan 1, 2018

Reopening this because it breaks deletion of items ...

@Ghabry Ghabry reopened this Jan 1, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment