fix for DEV-27483/SEC-283: Viewer crash: LLXform::setParent Creating loop when setting parent
parent
6f613fb70f
commit
cb8641a639
|
|
@ -173,7 +173,7 @@ BOOL LLXform::setParent(LLXform* parent)
|
|||
{
|
||||
if (cur_par == this)
|
||||
{
|
||||
llwarns << "LLXform::setParent Creating loop when setting parent!" << llendl;
|
||||
//llwarns << "LLXform::setParent Creating loop when setting parent!" << llendl;
|
||||
return FALSE;
|
||||
}
|
||||
cur_par = cur_par->mParent;
|
||||
|
|
|
|||
|
|
@ -512,15 +512,24 @@ BOOL LLViewerObject::isOverGroupOwnedLand() const
|
|||
&& mRegionp->getParcelOverlay()->isOwnedGroup(getPositionRegion());
|
||||
}
|
||||
|
||||
void LLViewerObject::setParent(LLViewerObject* parent)
|
||||
BOOL LLViewerObject::setParent(LLViewerObject* parent)
|
||||
{
|
||||
LLPrimitive::setParent(parent);
|
||||
if(mParent != parent)
|
||||
{
|
||||
LLViewerObject* old_parent = (LLViewerObject*)mParent ;
|
||||
BOOL ret = LLPrimitive::setParent(parent);
|
||||
if(ret && old_parent && parent)
|
||||
{
|
||||
old_parent->removeChild(this) ;
|
||||
}
|
||||
return ret ;
|
||||
}
|
||||
|
||||
return FALSE ;
|
||||
}
|
||||
|
||||
void LLViewerObject::addChild(LLViewerObject *childp)
|
||||
{
|
||||
BOOL result = TRUE;
|
||||
|
||||
for (child_list_t::iterator i = mChildList.begin(); i != mChildList.end(); ++i)
|
||||
{
|
||||
if (*i == childp)
|
||||
|
|
@ -535,18 +544,9 @@ void LLViewerObject::addChild(LLViewerObject *childp)
|
|||
childp->mbCanSelect = mbCanSelect;
|
||||
}
|
||||
|
||||
childp->setParent(this);
|
||||
mChildList.push_back(childp);
|
||||
|
||||
if (!result)
|
||||
if(childp->setParent(this))
|
||||
{
|
||||
llwarns << "Failed to attach child " << childp->getID() << " to object " << getID() << llendl;
|
||||
removeChild(childp);
|
||||
if (mJointInfo)
|
||||
{
|
||||
delete mJointInfo;
|
||||
mJointInfo = NULL;
|
||||
}
|
||||
mChildList.push_back(childp);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -562,7 +562,11 @@ void LLViewerObject::removeChild(LLViewerObject *childp)
|
|||
}
|
||||
|
||||
mChildList.erase(i);
|
||||
childp->setParent(NULL);
|
||||
|
||||
if(childp->getParent() == this)
|
||||
{
|
||||
childp->setParent(NULL);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -644,11 +648,14 @@ BOOL LLViewerObject::setDrawableParent(LLDrawable* parentp)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
LLDrawable* old_parent = mDrawable->mParent;
|
||||
|
||||
mDrawable->mParent = parentp;
|
||||
|
||||
BOOL ret = mDrawable->mXform.setParent(parentp ? &parentp->mXform : NULL);
|
||||
if(!ret)
|
||||
{
|
||||
return FALSE ;
|
||||
}
|
||||
LLDrawable* old_parent = mDrawable->mParent;
|
||||
mDrawable->mParent = parentp;
|
||||
|
||||
gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_VOLUME, TRUE);
|
||||
if( old_parent != parentp &&
|
||||
old_parent || (parentp && parentp->isActive()))
|
||||
|
|
|
|||
|
|
@ -237,7 +237,7 @@ public:
|
|||
BOOL isProbablyModifiable() const;
|
||||
*/
|
||||
|
||||
virtual void setParent(LLViewerObject* parent);
|
||||
virtual BOOL setParent(LLViewerObject* parent);
|
||||
virtual void addChild(LLViewerObject *childp);
|
||||
virtual void removeChild(LLViewerObject *childp);
|
||||
const_child_list_t& getChildren() const { return mChildList; }
|
||||
|
|
|
|||
|
|
@ -5315,12 +5315,13 @@ void LLVOAvatar::hideSkirt()
|
|||
mMeshLOD[MESH_ID_SKIRT]->setVisible(FALSE, TRUE);
|
||||
}
|
||||
|
||||
void LLVOAvatar::setParent(LLViewerObject* parent)
|
||||
BOOL LLVOAvatar::setParent(LLViewerObject* parent)
|
||||
{
|
||||
BOOL ret ;
|
||||
if (parent == NULL)
|
||||
{
|
||||
getOffObject();
|
||||
LLViewerObject::setParent(parent);
|
||||
ret = LLViewerObject::setParent(parent);
|
||||
if (isSelf())
|
||||
{
|
||||
gAgent.resetCamera();
|
||||
|
|
@ -5328,9 +5329,13 @@ void LLVOAvatar::setParent(LLViewerObject* parent)
|
|||
}
|
||||
else
|
||||
{
|
||||
LLViewerObject::setParent(parent);
|
||||
sitOnObject(parent);
|
||||
ret = LLViewerObject::setParent(parent);
|
||||
if(ret)
|
||||
{
|
||||
sitOnObject(parent);
|
||||
}
|
||||
}
|
||||
return ret ;
|
||||
}
|
||||
|
||||
void LLVOAvatar::addChild(LLViewerObject *childp)
|
||||
|
|
|
|||
|
|
@ -776,7 +776,7 @@ private:
|
|||
**/
|
||||
|
||||
public:
|
||||
virtual void setParent(LLViewerObject* parent);
|
||||
virtual BOOL setParent(LLViewerObject* parent);
|
||||
virtual void addChild(LLViewerObject *childp);
|
||||
virtual void removeChild(LLViewerObject *childp);
|
||||
|
||||
|
|
|
|||
|
|
@ -934,17 +934,20 @@ void LLVOVolume::updateFaceFlags()
|
|||
}
|
||||
}
|
||||
|
||||
void LLVOVolume::setParent(LLViewerObject* parent)
|
||||
BOOL LLVOVolume::setParent(LLViewerObject* parent)
|
||||
{
|
||||
BOOL ret = FALSE ;
|
||||
if (parent != getParent())
|
||||
{
|
||||
LLViewerObject::setParent(parent);
|
||||
if (mDrawable)
|
||||
ret = LLViewerObject::setParent(parent);
|
||||
if (ret && mDrawable)
|
||||
{
|
||||
gPipeline.markMoved(mDrawable);
|
||||
gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_VOLUME, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
return ret ;
|
||||
}
|
||||
|
||||
// NOTE: regenFaces() MUST be followed by genTriangles()!
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ public:
|
|||
/*virtual*/ BOOL isHUDAttachment() const;
|
||||
|
||||
void generateSilhouette(LLSelectNode* nodep, const LLVector3& view_point);
|
||||
/*virtual*/ void setParent(LLViewerObject* parent);
|
||||
/*virtual*/ BOOL setParent(LLViewerObject* parent);
|
||||
S32 getLOD() const { return mLOD; }
|
||||
const LLVector3 getPivotPositionAgent() const;
|
||||
const LLMatrix4& getRelativeXform() const { return mRelativeXform; }
|
||||
|
|
|
|||
Loading…
Reference in New Issue