瀏覽代碼

Fixed reference counting issue with Curve.

Darryl Gough 13 年之前
父節點
當前提交
f359fe4990
共有 1 個文件被更改,包括 4 次插入1 次删除
  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.
     // get property component count, and ensure the property exists on the AnimationTarget by getting the property component count.
     assert(_target->getAnimationPropertyComponentCount(propertyId));
     assert(_target->getAnimationPropertyComponentCount(propertyId));
-
+    _curve->addRef();
     _target->addChannel(this);
     _target->addChannel(this);
 }
 }
 
 
 Animation::Channel::Channel(const Channel& copy, Animation* animation, AnimationTarget* target)
 Animation::Channel::Channel(const Channel& copy, Animation* animation, AnimationTarget* target)
     : _animation(animation), _target(target), _propertyId(copy._propertyId), _curve(copy._curve), _duration(copy._duration)
     : _animation(animation), _target(target), _propertyId(copy._propertyId), _curve(copy._curve), _duration(copy._duration)
 {
 {
+    _curve->addRef();
     _target->addChannel(this);
     _target->addChannel(this);
 }
 }
 
 
@@ -303,6 +304,7 @@ Animation::Channel* Animation::createChannel(AnimationTarget* target, int proper
     SAFE_DELETE(normalizedKeyTimes);
     SAFE_DELETE(normalizedKeyTimes);
 
 
     Channel* channel = new Channel(this, target, propertyId, curve, duration);
     Channel* channel = new Channel(this, target, propertyId, curve, duration);
+    curve->release();
     addChannel(channel);
     addChannel(channel);
     return channel;
     return channel;
 }
 }
@@ -339,6 +341,7 @@ Animation::Channel* Animation::createChannel(AnimationTarget* target, int proper
     SAFE_DELETE(normalizedKeyTimes);
     SAFE_DELETE(normalizedKeyTimes);
 
 
     Channel* channel = new Channel(this, target, propertyId, curve, duration);
     Channel* channel = new Channel(this, target, propertyId, curve, duration);
+    curve->release();
     addChannel(channel);
     addChannel(channel);
     return channel;
     return channel;
 }
 }