Changes to llkeyframemotionparam.cpp as result of audit.

These changes were the result of my Motion leak audit.
However, there is a serious problem with LLKeyframeMotionParam
in that it stores plain pointers to objects that can and will be deleted
by other objects. Its the classicial LL example of coding
non-Object-Oriented badly maintainable and instable code.

I cannot make sure this won't go wrong for the simple fact
that LLKeyframeMotionParam is not used at ALL in our code.
Hence, the next commit will rather delete this file.
This commit is merely to have a record of this finding.
This commit is contained in:
Aleric Inglewood
2013-12-02 16:13:08 +01:00
parent 0438f070f7
commit a5b68f2da2

View File

@@ -68,11 +68,18 @@ LLKeyframeMotionParam::~LLKeyframeMotionParam()
iter != mParameterizedMotions.end(); ++iter)
{
motion_list_t& motionList = iter->second;
#if 0
// Singu note: this class is NOT responsible for cleaning up paramMotion.mMotion.
// They were obtained in LLKeyframeMotionParam::addKeyframeMotion by calling
// LLCharacter::createMotion which returns LLMotionController::createMotion
// which is responsible for cleaning up (by storing the pointers in
// LLMotionController::mAllMotions).
for (motion_list_t::iterator iter2 = motionList.begin(); iter2 != motionList.end(); ++iter2)
{
const ParameterizedMotion& paramMotion = *iter2;
delete paramMotion.mMotion;
}
#endif
motionList.clear();
}
mParameterizedMotions.clear();
@@ -98,7 +105,11 @@ LLMotion::LLMotionInitStatus LLKeyframeMotionParam::onInitialize(LLCharacter *ch
{
const ParameterizedMotion& paramMotion = *iter2;
LLMotion* motion = paramMotion.mMotion;
motion->onInitialize(character);
if (motion->onInitialize(character) != STATUS_SUCCESS)
{
llwarns << "Skipping uninitialize motion!" << llendl;
continue;
}
if (motion->getDuration() > mEaseInDuration)
{