File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed
Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -834,21 +834,28 @@ void AnimatedVisualPlayer::DestroyAnimations() {
834834 // Call RequestCommit to make sure that previous compositor calls complete before destroying animations.
835835 // RequestCommitAsync is available only for RS4+
836836 m_rootVisual.Compositor ().RequestCommitAsync ().Completed (
837- [&, createAnimationsCounter = m_createAnimationsCounter](auto , auto ) {
837+ [me_weak = get_weak (), createAnimationsCounter = m_createAnimationsCounter](auto , auto ) {
838+ auto me = me_weak.get ();
839+
840+ if (!me)
841+ {
842+ return ;
843+ }
844+
838845 // Check if there was any CreateAnimations call after DestroyAnimations.
839846 // We should not destroy animations in this case,
840847 // they will be destroyed by the following DestroyAnimations call.
841- if (createAnimationsCounter != m_createAnimationsCounter) {
848+ if (createAnimationsCounter != me-> m_createAnimationsCounter ) {
842849 return ;
843850 }
844851
845852 // Check if current animated visual supports destroyig animations.
846- if (const auto & animatedVisual = m_animatedVisual.get ())
853+ if (const auto & animatedVisual = me-> m_animatedVisual .get ())
847854 {
848855 if (const auto & animatedVisual2 = animatedVisual.try_as <winrt::IAnimatedVisual2>())
849856 {
850857 animatedVisual2.DestroyAnimations ();
851- m_isAnimationsCreated = false ;
858+ me-> m_isAnimationsCreated = false ;
852859 }
853860 }
854861 }
You can’t perform that action at this time.
0 commit comments