Skip to content

Conversation

dhindrik
Copy link
Collaborator

No description provided.

@johankson
Copy link
Collaborator

What does this solve?

{
try
{
if (subscription.Owner.Target == null)
Copy link
Collaborator

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.

Copy link
Collaborator Author

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?

if (subscription.Owner.Target == null)
{
subscriptionsToRemove.Add(subscription);
continue;
Copy link
Collaborator

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?

Copy link
Collaborator Author

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

@johankson
Copy link
Collaborator

Missing unit-tests to verify the old and new logic.

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