From 0160c514c5e0bc3e575b33ef27924a9c8c7c30cf Mon Sep 17 00:00:00 2001 From: Stinson Linden Date: Fri, 23 May 2014 21:56:44 +0100 Subject: MAINT-4077: Refactoring to add copy constructors to the LLVisualParam class and all of its derived descendants in order to clarify ownership of memory pointers. --- indra/llcharacter/llvisualparam.cpp | 29 +++++++++++++++++++++-------- indra/llcharacter/llvisualparam.h | 2 ++ 2 files changed, 23 insertions(+), 8 deletions(-) (limited to 'indra/llcharacter') diff --git a/indra/llcharacter/llvisualparam.cpp b/indra/llcharacter/llvisualparam.cpp index dd87847c18..4f7898ef49 100755 --- a/indra/llcharacter/llvisualparam.cpp +++ b/indra/llcharacter/llvisualparam.cpp @@ -159,29 +159,42 @@ void LLVisualParamInfo::toStream(std::ostream &out) //----------------------------------------------------------------------------- // LLVisualParam() //----------------------------------------------------------------------------- -LLVisualParam::LLVisualParam() - : - mCurWeight( 0.f ), +LLVisualParam::LLVisualParam() + : mCurWeight( 0.f ), mLastWeight( 0.f ), mNext( NULL ), mTargetWeight( 0.f ), mIsAnimating( FALSE ), + mIsDummy(FALSE), mID( -1 ), mInfo( 0 ), - mIsDummy(FALSE), mParamLocation(LOC_UNKNOWN) { } +//----------------------------------------------------------------------------- +// LLVisualParam() +//----------------------------------------------------------------------------- +LLVisualParam::LLVisualParam(const LLVisualParam& pOther) + : mCurWeight(pOther.mCurWeight), + mLastWeight(pOther.mLastWeight), + mNext(pOther.mNext), + mTargetWeight(pOther.mTargetWeight), + mIsAnimating(pOther.mIsAnimating), + mIsDummy(pOther.mIsDummy), + mID(pOther.mID), + mInfo(pOther.mInfo), + mParamLocation(pOther.mParamLocation) +{ +} + //----------------------------------------------------------------------------- // ~LLVisualParam() //----------------------------------------------------------------------------- LLVisualParam::~LLVisualParam() { - if (mNext != NULL) - { - delete mNext; - } + delete mNext; + mNext = NULL; } /* diff --git a/indra/llcharacter/llvisualparam.h b/indra/llcharacter/llvisualparam.h index 78c776705f..e49b1225c3 100755 --- a/indra/llcharacter/llvisualparam.h +++ b/indra/llcharacter/llvisualparam.h @@ -166,6 +166,8 @@ public: EParamLocation getParamLocation() const { return mParamLocation; } protected: + LLVisualParam(const LLVisualParam& pOther); + F32 mCurWeight; // current weight F32 mLastWeight; // last weight LLVisualParam* mNext; // next param in a shared chain -- cgit v1.2.3