-
Notifications
You must be signed in to change notification settings - Fork 32
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
crash on Android when loading prevoius levels #171
Comments
I've disabled prompting for puzzle solutions in 1c506dd on Android which fixes the crash but doesn't solve the underlying issue that some sort of mangling that happens when data is passed from the dialog prompt between C++ and Java. (This issue is exclusive to the Android version and doesn't occur with the GTK3 dialogs on desktop) |
Some technical details: When the dialog opens (src/src/menu_pkg.cc:483) it sends a pointer to some data (open_play_data) within a principia_action to accompany the button label. open_play_data *opd = new open_play_data(LEVEL_LOCAL, level_id, &pkg, false, 1);
ui::confirm("Do you want to load your last saved solution?",
"Yes", principia_action(ACTION_OPEN_MAIN_PUZZLE_SOLUTION, opd),
"No", principia_action(ACTION_CREATE_MAIN_PUZZLE_SOLUTION, opd),
"Cancel", principia_action(ACTION_IGNORE, 0)); For Android ui::confirm is implemented in src/src/ui_android.hh at ~line 81 which passes a reference to the action data over the JNI from C++ to Java: env->CallStaticVoidMethod(cls, mid,
_text,
_button1, (jint)action1.action_id, (jlong)action1.action_data,
_button2, (jint)action2.action_id, (jlong)action2.action_data,
_button3, (jint)action3.action_id, (jlong)action3.action_data,
(jboolean)_confirm_data.confirm_type == CONFIRM_TYPE_BACK_SANDBOX); This in turn calls
Then, segfault. The pointer is garbage and it fails when trying to get the package type. Clue: The crash only occurs on 64-bit. I can reproduce the issue on my 64-bit ARM phone or on an x86_64 emulator. I cannot reproduce the issue on 32-bit ARM (namely my Nexus 7 tablet), which would make me believe it has something about pointer sizes differing that causes issues when sending it over the JNI in ui::confirm. This would also explain why it never caused issues in 2014 since the game did not have a 64-bit build back then. But I really do not know where the issue exactly lies. Maybe someone smarter than me could point to how to actually fix it. |
Principia version
24.02.29
OS / Hardware
Summary
When I load any previous level, game crashes
Steps to reproduce
49fc114e-612b-4321-a0d5-08ff404bcf14.mp4
The text was updated successfully, but these errors were encountered: