Closed
Conversation
c3d
requested changes
Mar 4, 2026
Owner
c3d
left a comment
There was a problem hiding this comment.
Thanks a lot @mdjurfeldt, this looks good overall, but I think you need to clear is_dialog_open on completion of the dialog.
| { | ||
| #ifdef ANDROID | ||
| // Engage the lock. If it was already true (e.g. touch bounce), safely abort. | ||
| if (is_dialog_open.exchange(true)) { |
Owner
There was a problem hiding this comment.
Where is is_dialog_open ever set to false?
Author
There was a problem hiding this comment.
@c3d Dear Christophe, you are absolutely right. I have now added the set to false and force-pushed a new version.
BTW, many thanks for this amazing project! :-)
Under Android, trying to display a load state message during boot will often fail due to a race condition with the UI thread. This causes the message to remain on the screen. Something similar happens when the app is suspended. In the simulator on a PC, a load state message during boot is not needed. This change eliminates the load and state messages during the above conditions but does show them otherwise.
On modern Android, android.permission.WRITE_EXTERNAL_STORAGE (as requested in AndroidManifest.xml) is deprecated. This change uses the file selector to obtain temporary right to read and write state files. These are then copied to or from internal storage in order for further internals to be able to read and write state to said internal storage. Note that the read or write to the users selected location will only be made when using the file selector. Further reads or writes will go from or to internal storage. It *is* possible to obtain read and write access to external storage, but this is discouraged by Google and might cause problems if trying to get the app available in the Play Store.
The file selector window will generate an ApplicationHidden event. This change prevents a recursive entry into the save state code path due to this.
This change enables the Android file selector window to be shown. Previously, it was not shown due to non-valid parent context and Linux initialization file path.
d2d8327 to
c658cc5
Compare
c658cc5 to
b72c3ca
Compare
8789ffe to
aa8cb69
Compare
Owner
|
Merged on |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes multiple problems regarding saving state on Android devices.
It enables the SaveState function to work properly, after which state will be saved and reloaded when the app launches again.
However, due to permission rules on Android, the autosave of state upon app suspension will not go to the latest user selected file in external storage but an internal file. All saves to external storage needs to be done through SaveState.