Skip to content

Fix StateError when unregistering non-async singletons other singletons are dependent on #227

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

Merged
merged 1 commit into from
Feb 2, 2022

Conversation

ioantsaf
Copy link
Contributor

@ioantsaf ioantsaf commented Oct 7, 2021

When registering a singleton that other singletons are dependent on, the instance's objectsWaiting list gets filled with the dependent singletons. This list is cleared for async singletons, when they have been created, as of fix for #210.

The list is not cleared for non-async singletons, which results in them being unable to be unregistered at any time with the StateError( 'There are still other objects waiting for this instance so signal ready'.

This PR fixes the unexpected exception by clearing the objectsWaiting when a non-async singleton has been initialized.

@ioantsaf
Copy link
Contributor Author

ioantsaf commented Oct 8, 2021

Hi @escamoteur, could you please check this pull request?

@escamoteur escamoteur merged commit 70bb536 into fluttercommunity:master Feb 2, 2022
@escamoteur
Copy link
Collaborator

Hi, sorry for not looking into this earlier, but I had some mental health problems the last half year.
Good catch. Will push it today with other PRs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants