Skip to content

Android: Ensure fragment has not been disposed while updating left bar button#23416

Merged
PureWeen merged 1 commit into
dotnet:mainfrom
albyrock87:issue-14801
Jul 4, 2024
Merged

Android: Ensure fragment has not been disposed while updating left bar button#23416
PureWeen merged 1 commit into
dotnet:mainfrom
albyrock87:issue-14801

Conversation

@albyrock87
Copy link
Copy Markdown
Contributor

Description of Change

UpdateLeftBarButtonItem is an async void, so it is not being awaited by the navigation.

This means that we might have a race condition every time we do await, because the page might be gone at that time due to an immediate pop navigation.

This PR adds a check on the _isDisposed flag every time we await for something.

Issues Fixed

Fixes #14801

@albyrock87 albyrock87 requested a review from a team as a code owner July 3, 2024 11:45
@dotnet-policy-service dotnet-policy-service Bot added the community ✨ Community Contribution label Jul 3, 2024
@dotnet-policy-service
Copy link
Copy Markdown
Contributor

Hey there @albyrock87! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

@albyrock87 albyrock87 force-pushed the issue-14801 branch 2 times, most recently from 8b64f91 to 5184f89 Compare July 3, 2024 11:50
@PureWeen
Copy link
Copy Markdown
Member

PureWeen commented Jul 3, 2024

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 3 pipeline(s).

@PureWeen PureWeen enabled auto-merge (squash) July 4, 2024 12:09
Comment thread src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue14801.cs Outdated
auto-merge was automatically disabled July 4, 2024 14:23

Head branch was pushed to by a user without write access

@albyrock87 albyrock87 requested a review from PureWeen July 4, 2024 14:26
@PureWeen
Copy link
Copy Markdown
Member

PureWeen commented Jul 4, 2024

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 3 pipeline(s).

@PureWeen PureWeen enabled auto-merge (squash) July 4, 2024 20:52
@PureWeen PureWeen merged commit c163c80 into dotnet:main Jul 4, 2024
@albyrock87 albyrock87 deleted the issue-14801 branch July 4, 2024 21:26
@samhouts samhouts added fixed-in-8.0.70 fixed-in-net9.0-nightly This may be available in a nightly release! labels Aug 2, 2024
@github-actions github-actions Bot locked and limited conversation to collaborators Sep 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

community ✨ Community Contribution fixed-in-8.0.70 fixed-in-net9.0-nightly This may be available in a nightly release!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NullReferenceException in UpdateLeftBarButtonItem

3 participants