Browse Source

Removed unnecessary construction of a SharedPtr object.

Lasse Öörni 11 năm trước cách đây
mục cha
commit
5790875b23

+ 1 - 4
Source/Engine/Graphics/Material.cpp

@@ -423,9 +423,6 @@ void Material::SetShaderParameterAnimation(const String& name, ValueAnimation* a
             return;
         }
 
-        // Use shared ptr to avoid memory leak
-        SharedPtr<ValueAnimation> animationPtr(animation);
-
         if (shaderParameters_.Find(name) == shaderParameters_.End())
         {
             LOGERROR(GetName() + " has no shader parameter: " + name);
@@ -433,7 +430,7 @@ void Material::SetShaderParameterAnimation(const String& name, ValueAnimation* a
         }
         
         StringHash nameHash(name);
-        shaderParameterAnimationInfos_[nameHash] = new ShaderParameterAnimationInfo(this, name, animationPtr, wrapMode, speed);
+        shaderParameterAnimationInfos_[nameHash] = new ShaderParameterAnimationInfo(this, name, animation, wrapMode, speed);
     }
     else
     {

+ 2 - 5
Source/Engine/Scene/Animatable.cpp

@@ -177,9 +177,6 @@ void Animatable::SetAttributeAnimation(const String& name, ValueAnimation* attri
             return;
         }
 
-        // Use shared ptr to avoid memory leak
-        SharedPtr<ValueAnimation> animationPtr(attributeAnimation);
-
         // Get attribute info
         const AttributeInfo* attributeInfo = 0;
         if (info)
@@ -210,7 +207,7 @@ void Animatable::SetAttributeAnimation(const String& name, ValueAnimation* attri
         }
 
         // Check value type is same with attribute type
-        if (animationPtr->GetValueType() != attributeInfo->type_)
+        if (attributeAnimation->GetValueType() != attributeInfo->type_)
         {
             LOGERROR("Invalid value type");
             return;
@@ -220,7 +217,7 @@ void Animatable::SetAttributeAnimation(const String& name, ValueAnimation* attri
         if (attributeInfo->mode_ & AM_NET)
             animatedNetworkAttributes_.Insert(attributeInfo);
 
-        attributeAnimationInfos_[name] = new AttributeAnimationInfo(this, *attributeInfo, animationPtr, wrapMode, speed);
+        attributeAnimationInfos_[name] = new AttributeAnimationInfo(this, *attributeInfo, attributeAnimation, wrapMode, speed);
 
         if (!info)
             OnAttributeAnimationAdded();

+ 1 - 1
Source/Engine/UI/UI.h

@@ -211,7 +211,7 @@ private:
     SharedPtr<Cursor> cursor_;
     /// UI element being dragged.
     WeakPtr<UIElement> dragElement_;
-    /// Currently focused element
+    /// Currently focused element.
     WeakPtr<UIElement> focusElement_;
     /// UI rendering batches.
     PODVector<UIBatch> batches_;