Skip to content

fix!: Timeline shouldn't implement IDisposable - #12176

Closed
Youssef1313 wants to merge 4 commits into
unoplatform:feature/breaking-changesfrom
Youssef1313:timeline-disposable
Closed

Youssef1313 wants to merge 4 commits into
unoplatform:feature/breaking-changesfrom
Youssef1313:timeline-disposable

Conversation

@Youssef1313

Copy link
Copy Markdown
Member

BREAKING CHANGE: Timeline shouldn't implement IDisposable

GitHub Issue (If applicable): Part of #8339

PR Type

What kind of change does this PR introduce?

What is the current behavior?

What is the new behavior?

PR Checklist

Please check if your PR fulfills the following requirements:

Other information

Internal Issue (If applicable):

BREAKING CHANGE: Timeline shouldn't implement `IDisposable`
@github-actions github-actions Bot added the area/build Categorizes an issue or PR as relevant to build infrastructure label May 5, 2023
Comment on lines +119 to 122
~ColorAnimation()
{
if (disposing)
{
_animationImplementation.Dispose();
}

base.Dispose(disposing);
_animationImplementation.Dispose();
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may be incorrect, as it may call UI Thread-affine APIs on the GC's thread. It may be needed to schedule the disposable on the dispatcher, somehow.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was expecting that I might be doing something wrong, but I couldn't really figure out a different way.

It may be needed to schedule the disposable on the dispatcher, somehow.

Just a _ = Dispatcher.RunAsync(...)?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's likely better, yes.

@Youssef1313
Youssef1313 requested a review from jeromelaban May 7, 2023 14:31
@Youssef1313
Youssef1313 force-pushed the timeline-disposable branch from b081627 to 3b9e59f Compare May 7, 2023 15:39

DisposePartial();
}
_subscriptions.Dispose();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you dispatch from here as well?

{
base.Dispose(disposing);

if (_frameScheduler != null)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have the same problem here :)

Children[i].Dispose();
}
}
Children = null;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Likely here as well, as TimelineCollection is a DependencyObject

}
}

protected override void Dispose(bool disposing)

@jeromelaban jeromelaban May 8, 2023 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After thinking about it, we probably should be relying on storyboard only to dispose all inner items. Let's keep the Dispose methods (but internal) and schedule only once from Storyboard. This will stress the GC less, and avoid additional circular references issues.

@Youssef1313

Copy link
Copy Markdown
Member Author

Replaced by #12201

@Youssef1313 Youssef1313 closed this May 8, 2023
@Youssef1313
Youssef1313 deleted the timeline-disposable branch May 8, 2023 16:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/build Categorizes an issue or PR as relevant to build infrastructure

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants