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

Clear ReferenceNode ParamNames before serializing each expression string to avoid collisions #4183

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,8 @@ public static void StartAnimation(this CompositionObject compObject, string prop
/// <param name="easing">The easing function to use when interpolating between frames.</param>
public static void InsertExpressionKeyFrame(this KeyFrameAnimation keyframeAnimation, float normalizedProgressKey, ExpressionNode expressionNode, CompositionEasingFunction easing = null)
{
expressionNode.ClearReferenceInfo();

keyframeAnimation.InsertExpressionKeyFrame(normalizedProgressKey, expressionNode.ToExpressionString(), easing);

expressionNode.SetAllParameters(keyframeAnimation);
Expand Down Expand Up @@ -252,6 +254,7 @@ private static ExpressionAnimation CreateExpressionAnimationFromNode(Compositor
// Only create a new animation if this node hasn't already generated one before, so we don't have to re-parse the expression string.
if (expressionNode.ExpressionAnimation == null)
{
expressionNode.ClearReferenceInfo();
expressionNode.ExpressionAnimation = compositor.CreateExpressionAnimation(expressionNode.ToExpressionString());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,20 @@ internal string ToExpressionString()
return ToExpressionStringInternal();
}

/// <summary>
/// Clears the reference information.
/// </summary>
/// <exception cref="System.Exception">Reference and paramName can't both be null</exception>
internal void ClearReferenceInfo()
{
_objRefList = null;
ParamName = null;
foreach (var child in Children)
{
child.ClearReferenceInfo();
}
}

/// <summary>
/// Ensures the reference information.
/// </summary>
Expand Down