Skip to content
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: setState shouldn't be called from onDispose #1769

Merged
merged 4 commits into from
May 6, 2022

Conversation

g123k
Copy link
Collaborator

@g123k g123k commented May 6, 2022

A setState() call is launched whenever we were in a "paused" or "disposed" state.
In disposed, setState cannot be called.

Will fix #1768

@g123k g123k self-assigned this May 6, 2022
@g123k g123k requested a review from a team as a code owner May 6, 2022 11:15
@g123k g123k changed the title setState shouldn't be called from onDispose fix: setState shouldn't be called from onDispose May 6, 2022
@github-actions github-actions bot added 🤳 MLKit 🤳🥫 Scan We need to be able to scan on low-end, old devices, even with a bad camera, connexion… labels May 6, 2022
@teolemon teolemon added this to the V1 milestone May 6, 2022
@@ -190,7 +190,7 @@ class MLKitScannerPageState extends State<_MLKitScannerPageContent> {
}

stoppingCamera = true;
if (mounted) {
if (!fromDispose && mounted) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would feel safer the other way around: mounted && !fromDispose (I never know if ! is stronger than &&).

@monsieurtanuki monsieurtanuki merged commit f008f00 into develop May 6, 2022
@monsieurtanuki monsieurtanuki deleted the mldkit_stop_live_stream_dispose branch May 6, 2022 20:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤳 MLKit 🤳🥫 Scan We need to be able to scan on low-end, old devices, even with a bad camera, connexion…
Development

Successfully merging this pull request may close these issues.

MLKitScanPage: if the Widget is disposed, setState shouldn't be called
4 participants