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
Fix racey dialog dismissal in PlacePickerActivity
#13461
Open
fynngodau
wants to merge
4
commits into
signalapp:main
Choose a base branch
from
e-foundation:fix-racey-dismiss-dialog
base: main
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains 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
Avoids a race condition when dismiss is delayed because the progress bar hadn't been shown for long enough, while avoiding the flickering that would be caused when immediately dismissing the dialog earlier.
In case `dismiss` (with delay) is called during an activity and the activity is consequently destroyed, and calls `dismissNow` in the process of its cleanup (i.e. in `onDestroy`), the delayed `dismiss` callback could still try to dismiss the dialog, causing an `IllegalArgumentException: View[…] not attached to window manager`. To avoid this faulty behavior, the delayed callbacks are removed whenever `dismissNow` is called.
alex-signal
reviewed
Mar 6, 2024
app/src/main/java/org/thoughtcrime/securesms/maps/PlacePickerActivity.java
Outdated
Show resolved
Hide resolved
alex-signal
requested changes
Mar 11, 2024
.../org/thoughtcrime/securesms/components/settings/conversation/ConversationSettingsFragment.kt
Outdated
Show resolved
Hide resolved
...ava/org/thoughtcrime/securesms/conversation/mutiselect/forward/MultiselectForwardFragment.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/org/thoughtcrime/securesms/conversationlist/ConversationListFragment.java
Outdated
Show resolved
Hide resolved
...sms/groups/ui/invitesandrequests/invite/GroupLinkInviteFriendsBottomSheetDialogFragment.java
Outdated
Show resolved
Hide resolved
...ava/org/thoughtcrime/securesms/recipients/ui/sharablegrouplink/ShareableGroupLinkFragment.kt
Outdated
Show resolved
Hide resolved
@alex-signal I added another commit with your requested changes. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
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.
First time contributor checklist
Contributor checklist
Fixes #1234
syntaxDescription
The first commit avoids a race condition with closing the location picker map for location sharing where the following exception would occur:
This was because
dismiss
, together with its delay, could be executed after the activity that contained the dialog,PlacePickerActivity
, had already been destroyed. This faulty behavior can be reproduced more easily when artificially increasing the minimum time that the dialog should be shown. Instead of potentially scheduling a dismissal for the future usingdismiss
,dismissNow
is now called duringonDestroy
.The second commit avoids similar problems in the future, because it ensures that the delayed dismiss callback is always cancelled when
dismissNow
is called (which it should be whenever the activity containing the progress bar is closed for some reason, which may be in between adismiss
call and thedismiss
-scheduled delayed dismissal.The second commit could be left out as the first one already fixes the crash I mentioned above, but I would recommend to add it nonetheless.