-
Notifications
You must be signed in to change notification settings - Fork 3
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
fixed owner null bug #30
base: main
Are you sure you want to change the base?
Conversation
What does this solve? |
@@ -334,6 +346,7 @@ public static TinyEventArgs PublishControlled<T>(string channel, T instance, Act | |||
if (subscription.Owner.Target == null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why doesn't just
subscriber.Owner?.Target == null
be enough? Instead of creating a static object? Just trying to understand.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, then it will think the owner is collected by GC. Maybe we should deprecate the method of not having an owner?
@@ -334,6 +346,7 @@ public static TinyEventArgs PublishControlled<T>(string channel, T instance, Act | |||
if (subscription.Owner.Target == null) | |||
{ | |||
subscriptionsToRemove.Add(subscription); | |||
continue; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why continue here? What happens if ActionWithArgumentAndArgs isn't null? Then it will not be called?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because if it is null the object owning it is been collected by GC. And then we can remove that subscription
Missing unit-tests to verify the old and new logic. |
No description provided.