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

Possible leak in RefreshContainer where it doesn't stop a "Forever" composition animation #9604

Open
Youssef1313 opened this issue May 2, 2024 · 3 comments
Labels
area-PullToRefresh bug Something isn't working team-Controls Issue for the Controls team

Comments

@Youssef1313
Copy link
Contributor

Youssef1313 commented May 2, 2024

Describe the bug

void RefreshVisualizer::ExecuteExecutingRotationAnimation()
{
PTR_TRACE_INFO(nullptr, TRACE_MSG_METH, METH_NAME, this);
if (m_content)
{
const winrt::Visual contentVisual = winrt::ElementCompositionPreview::GetElementVisual(m_content.get());
if (!m_compositor)
{
m_compositor.set(contentVisual.Compositor());
}
const winrt::ScalarKeyFrameAnimation contentExecutionRotationAnimation = m_compositor.get().CreateScalarKeyFrameAnimation();
contentExecutionRotationAnimation.InsertKeyFrame(0.0f, m_startingRotationAngle, m_compositor.get().CreateLinearEasingFunction());
contentExecutionRotationAnimation.InsertKeyFrame(1.0f, m_startingRotationAngle + (float)(2.0f * M_PI), m_compositor.get().CreateLinearEasingFunction());
contentExecutionRotationAnimation.Duration(500ms);
contentExecutionRotationAnimation.IterationBehavior(winrt::AnimationIterationBehavior::Forever);
const winrt::Size contentSize = m_content.get().RenderSize();
contentVisual.CenterPoint({ (float)(contentSize.Height / 2), (float)(contentSize.Width / 2), 0.0f });
contentVisual.StartAnimation(L"RotationAngle", contentExecutionRotationAnimation);
}
}

This animation apparently never stops?

So, if many RefreshContainers are repeatedly added to visual tree, goes into interacting state, then removed from visual tree, those animations are likely to get stuck?

This shouldn't be a problem for a single RefreshContainer as the next interaction will cause another StartAnimation("RotationAngle", ..) which should stop the previous one.

Steps to reproduce the bug

Expected behavior

No response

Screenshots

No response

NuGet package version

None

Windows version

No response

Additional context

No response

@Youssef1313 Youssef1313 added the bug Something isn't working label May 2, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added the needs-triage Issue needs to be triaged by the area owners label May 2, 2024
Copy link

github-actions bot commented May 2, 2024

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one. Thank you!

Open similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

@codendone codendone added area-PullToRefresh team-Controls Issue for the Controls team and removed needs-triage Issue needs to be triaged by the area owners labels May 2, 2024
@codendone
Copy link
Contributor

Do you see an issue in the running app, or are you just noticing some suspect code?

@Youssef1313
Copy link
Contributor Author

Youssef1313 commented May 2, 2024

Just noticed suspicious code. The only way this can start causing issues is repeated interaction with different RefreshContainers. Each RefreshContainer will keep one animation running unnecessarily, if I understand correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-PullToRefresh bug Something isn't working team-Controls Issue for the Controls team
Projects
None yet
Development

No branches or pull requests

2 participants