Fixed memory stomping leading to Track View nodes with invalid labels and crash.

Signed-off-by: Chris Galvan <chgalvan@amazon.com>
This commit is contained in:
Chris Galvan
2021-08-24 15:29:00 -05:00
parent cd9621f16e
commit 306a7a622d
5 changed files with 20 additions and 16 deletions
@@ -150,16 +150,16 @@ private:
}
BehaviorPropertyInfo(const BehaviorPropertyInfo& other)
{
m_displayName = other.m_displayName;
m_animNodeParamInfo.paramType = other.m_displayName;
m_animNodeParamInfo.name = &m_displayName[0];
m_displayName = AZStd::move(other.m_displayName);
m_animNodeParamInfo.paramType = m_displayName;
m_animNodeParamInfo.name = m_displayName;
}
BehaviorPropertyInfo& operator=(const AZStd::string& str)
{
// TODO: clean this up - this weird memory sharing was copied from legacy Cry - could be better.
m_displayName = str;
m_animNodeParamInfo.paramType = str; // set type to AnimParamType::ByString by assigning a string
m_animNodeParamInfo.name = &m_displayName[0];
m_animNodeParamInfo.name = m_displayName;
return *this;
}
@@ -82,7 +82,7 @@ const char* CAnimNode::GetParamName(const CAnimParamType& paramType) const
SParamInfo info;
if (GetParamInfoFromType(paramType, info))
{
return info.name;
return info.name.c_str();
}
return "Unknown";