mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-01 14:58:14 +00:00
Fix a particular type of race condition in file dialog requests
It seems to be possible for a user to back out of a screen before receiving the "dialog completed" callback on Android, in which case things pointed to by the callback might be gone. In this case, it's better to simply not call the callback, rather than crashing. This is accomplished by assigning "Tokens" to screens that cause requests, and in ~Screen, invalidate any pending requests belonging to that token.
This commit is contained in:
1 parent
b4122ef1f4
commit
1304d04161
24 files changed
+174
-124
No files matched your search
@@ -356,7 +356,7 @@ UI::EventReturn MemStickScreen::SetFolderManually(UI::EventParams ¶ms) {
|
||||
// The old way, from before scoped storage.
|
||||
#if PPSSPP_PLATFORM(ANDROID) || PPSSPP_PLATFORM(SWITCH)
|
||||
auto sy = GetI18NCategory(I18NCat::SYSTEM);
|
||||
System_InputBoxGetString(sy->T("Memory Stick Folder"), g_Config.memStickDirectory.ToString(), [&](const std::string &value, int) {
|
||||
System_InputBoxGetString(GetRequesterToken(), sy->T("Memory Stick Folder"), g_Config.memStickDirectory.ToString(), [&](const std::string &value, int) {
|
||||
auto sy = GetI18NCategory(I18NCat::SYSTEM);
|
||||
auto di = GetI18NCategory(I18NCat::DIALOG);
|
||||
|
||||
@@ -469,7 +469,7 @@ UI::EventReturn MemStickScreen::UseStorageRoot(UI::EventParams ¶ms) {
|
||||
|
||||
UI::EventReturn MemStickScreen::Browse(UI::EventParams ¶ms) {
|
||||
auto mm = GetI18NCategory(I18NCat::MAINMENU);
|
||||
System_BrowseForFolder(mm->T("Choose folder"), [=](const std::string &value, int) {
|
||||
System_BrowseForFolder(GetRequesterToken(), mm->T("Choose folder"), [=](const std::string &value, int) {
|
||||
Path pendingMemStickFolder = Path(value);
|
||||
INFO_LOG(SYSTEM, "Got folder: '%s'", pendingMemStickFolder.c_str());
|
||||
// Browse finished. Let's pop up the confirmation dialog.
|
||||
|
||||
Reference in new issue
Block a user