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

Issue with reseting lazy Singletone #92

Closed
Sirrr opened this issue Jul 11, 2020 · 2 comments
Closed

Issue with reseting lazy Singletone #92

Sirrr opened this issue Jul 11, 2020 · 2 comments

Comments

@Sirrr
Copy link

Sirrr commented Jul 11, 2020

Below code will never call disposingFunction as it is first set to null then check if not null then function call.

void resetLazySingleton<T>({...}) {
 ...

instanceFactory.instance = null;
 ...

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

Yes, I noted the same, it need to check first the if test, and then set to null

@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