Repository navigation
Do not show the unsaved-edits dialog on a closing activity - #735
Merged
Merged
Conversation
andiwand
force-pushed
the
fix/722-leaving-edits-dialog
branch
from
October 25, 2026 13:05
67746a3 to
1d5df3a
Compare
andiwand
force-pushed
the
fix/722-leaving-edits-dialog
branch
from
October 25, 2026 13:22
1d5df3a to
cd1ae27
Compare
onDestroy finishes the edit action mode. The mode then asks about unsaved edits, so MainActivity shows an AlertDialog on a window that is going away. Android throws BadTokenException, or logs WindowLeaked. The most common path: a user leaves a document that another app opened, and discards the edits. leaveApp finishes the activity, but the edits are still in the page, so the destroy asks again. confirmLeavingEdits now returns when the activity is finishing or destroyed. Fixes #722 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JuNa2W75khbpynkiG9iDqF
andiwand
force-pushed
the
fix/722-leaving-edits-dialog
branch
from
October 25, 2026 13:27
cd1ae27 to
1b511ba
Compare
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.
🤖 Generated with Claude Code
Fixes #722.
MainActivity.onDestroyfinishes the edit action mode.EditActionModeCallback.onDestroyActionModethen callsconfirmLeavingEditsif the document has unsaved edits, so the activity shows anAlertDialogon a window that is going away. Android throwsBadTokenException, or logsWindowLeaked.The most common path: a user leaves a document that another app opened, and taps "Discard".
leaveAppfinishes the activity, but the edits are still in the page, so the destroy asks again. A finish or a recreate with unsaved edits in edit mode has the same result.Changes
confirmLeavingEditsreturns when the activity is finishing or destroyed. The edits go with the activity, as before.Testing
spotlessCheck assembleProDebug assembleLiteDebug testProDebugUnitTestpass (against core 7.6.0 locally, because 7.6.1 is not on Maven Central yet).show_alert_unsaved_changesandWindowLeaked. With the fix, it shows neither. This emulator does not throwBadTokenException, so the test cannot fail here, and I did not add it.