Skip to content

ResetLazySingleton: disposing function never called. #97

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

Closed
dannymanjon opened this issue Jul 22, 2020 · 4 comments
Closed

ResetLazySingleton: disposing function never called. #97

dannymanjon opened this issue Jul 22, 2020 · 4 comments

Comments

@dannymanjon
Copy link

Try to reset a lazy singleton providing a disposing function. The function its never called, after checking the implementation of get_it I notice the following:
at line 732, InstanceFactory.instance its set to null, then at line 736 the condition tests the instance to check if its null to call the disposing function, but the issue its the instance has been already set to null, so the disposing function will never be called

`instanceFactory.instance = null;
instanceFactory.pendingResult == null;
instanceFactory._readyCompleter = Completer();

if (instanceFactory.instance != null) {
  disposingFunction?.call(instanceFactory.instance as T);
}`
@Sirrr
Copy link

Sirrr commented Jul 22, 2020

Duplicate of #92
Yes there is an issue. Is this project no more maintained?...

@escamoteur
Copy link
Collaborator

@Sirrr uhm, maybe I was on vacation and do this in my free time?

@Sirrr
Copy link

Sirrr commented Jul 22, 2020

@escamoteur Sure, it's understandable. Happy to see that it is maintained.

@escamoteur
Copy link
Collaborator

fixed in V4.0.4

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

No branches or pull requests

3 participants