Commit 8d77d51e authored by andreykproductengine's avatar andreykproductengine
Browse files

SL-10908 Safeguards and potential crash fix

parent f486bdbb
......@@ -327,10 +327,13 @@ LLControlAvatar *LLControlAvatar::createControlAvatar(LLVOVolume *obj)
{
LLControlAvatar *cav = (LLControlAvatar*)gObjectList.createObjectViewer(LL_PCODE_LEGACY_AVATAR, gAgent.getRegion(), CO_FLAG_CONTROL_AVATAR);
cav->mRootVolp = obj;
if (cav)
{
cav->mRootVolp = obj;
// Sync up position/rotation with object
cav->matchVolumeTransform();
// Sync up position/rotation with object
cav->matchVolumeTransform();
}
return cav;
}
......
......@@ -119,7 +119,7 @@ void LLSky::restoreGL()
void LLSky::resetVertexBuffers()
{
if (gSky.mVOSkyp.notNull())
if (gSky.mVOSkyp.notNull() && gSky.mVOGroundp.notNull())
{
gPipeline.resetVertexBuffers(gSky.mVOSkyp->mDrawable);
gPipeline.resetVertexBuffers(gSky.mVOGroundp->mDrawable);
......
......@@ -203,7 +203,7 @@ LLVector2 LLSurfacePatch::getTexCoords(const U32 x, const U32 y) const
void LLSurfacePatch::eval(const U32 x, const U32 y, const U32 stride, LLVector3 *vertex, LLVector3 *normal,
LLVector2 *tex0, LLVector2 *tex1)
{
if (!mSurfacep || !mSurfacep->getRegion() || !mSurfacep->getGridsPerEdge())
if (!mSurfacep || !mSurfacep->getRegion() || !mSurfacep->getGridsPerEdge() || !mVObjp)
{
return; // failsafe
}
......
......@@ -1383,7 +1383,11 @@ BOOL LLViewerObjectList::killObject(LLViewerObject *objectp)
if (objectp)
{
objectp->markDead(); // does the right thing if object already dead
// We are going to cleanup a lot of smart pointers to this object, they might be last,
// and object being NULLed while inside it's own function won't be pretty
// so create a pointer to make sure object will stay alive untill markDead() finishes
LLPointer<LLViewerObject> sp(objectp);
sp->markDead(); // does the right thing if object already dead
return TRUE;
}
......
......@@ -916,10 +916,10 @@ void LLWorld::updateWaterObjects()
}
}
for (std::list<LLVOWater*>::iterator iter = mHoleWaterObjects.begin();
for (std::list<LLPointer<LLVOWater> >::iterator iter = mHoleWaterObjects.begin();
iter != mHoleWaterObjects.end(); ++ iter)
{
LLVOWater* waterp = *iter;
LLVOWater* waterp = (*iter).get();
gObjectList.killObject(waterp);
}
mHoleWaterObjects.clear();
......
......@@ -199,7 +199,7 @@ class LLWorld : public LLSingleton<LLWorld>
// Data for "Fake" objects
//
std::list<LLVOWater*> mHoleWaterObjects;
std::list<LLPointer<LLVOWater> > mHoleWaterObjects;
LLPointer<LLVOWater> mEdgeWaterObjects[8];
LLPointer<LLViewerTexture> mDefaultWaterTexturep;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment