Browse Source

Fixed reference counting issue with Curve.

Darryl Gough 13 năm trước cách đây
mục cha
commit
f359fe4990
1 tập tin đã thay đổi với 4 bổ sung1 xóa
  1. 4 1
      gameplay/src/Animation.cpp

+ 4 - 1
gameplay/src/Animation.cpp

@@ -65,13 +65,14 @@ Animation::Channel::Channel(Animation* animation, AnimationTarget* target, int p
 {
     // get property component count, and ensure the property exists on the AnimationTarget by getting the property component count.
     assert(_target->getAnimationPropertyComponentCount(propertyId));
-
+    _curve->addRef();
     _target->addChannel(this);
 }
 
 Animation::Channel::Channel(const Channel& copy, Animation* animation, AnimationTarget* target)
     : _animation(animation), _target(target), _propertyId(copy._propertyId), _curve(copy._curve), _duration(copy._duration)
 {
+    _curve->addRef();
     _target->addChannel(this);
 }
 
@@ -303,6 +304,7 @@ Animation::Channel* Animation::createChannel(AnimationTarget* target, int proper
     SAFE_DELETE(normalizedKeyTimes);
 
     Channel* channel = new Channel(this, target, propertyId, curve, duration);
+    curve->release();
     addChannel(channel);
     return channel;
 }
@@ -339,6 +341,7 @@ Animation::Channel* Animation::createChannel(AnimationTarget* target, int proper
     SAFE_DELETE(normalizedKeyTimes);
 
     Channel* channel = new Channel(this, target, propertyId, curve, duration);
+    curve->release();
     addChannel(channel);
     return channel;
 }