diff options
author | andreykproductengine <andreykproductengine@lindenlab.com> | 2019-07-15 17:56:30 +0300 |
---|---|---|
committer | andreykproductengine <andreykproductengine@lindenlab.com> | 2019-07-15 17:56:30 +0300 |
commit | 8d77d51e636f5384b0b024350a0a219e041b5446 (patch) | |
tree | 5411da7404f93816452addc81f9a9715edd2ad1b /indra | |
parent | f486bdbb48dda1364d71b8d80cc3c837efb96284 (diff) |
SL-10908 Safeguards and potential crash fix
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llcontrolavatar.cpp | 9 | ||||
-rw-r--r-- | indra/newview/llsky.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llsurfacepatch.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llviewerobjectlist.cpp | 6 | ||||
-rw-r--r-- | indra/newview/llworld.cpp | 4 | ||||
-rw-r--r-- | indra/newview/llworld.h | 2 |
6 files changed, 16 insertions, 9 deletions
diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index d24dac385f..92eeebd705 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -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; } diff --git a/indra/newview/llsky.cpp b/indra/newview/llsky.cpp index 3ef89ba920..5e2442798b 100644 --- a/indra/newview/llsky.cpp +++ b/indra/newview/llsky.cpp @@ -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); diff --git a/indra/newview/llsurfacepatch.cpp b/indra/newview/llsurfacepatch.cpp index f6cf714db4..5e056944e9 100644 --- a/indra/newview/llsurfacepatch.cpp +++ b/indra/newview/llsurfacepatch.cpp @@ -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 } diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp index 932759c86d..2bf04dc204 100644 --- a/indra/newview/llviewerobjectlist.cpp +++ b/indra/newview/llviewerobjectlist.cpp @@ -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; } diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp index cee47a591e..89f5eb86b3 100644 --- a/indra/newview/llworld.cpp +++ b/indra/newview/llworld.cpp @@ -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(); diff --git a/indra/newview/llworld.h b/indra/newview/llworld.h index c9ac241d5a..993fbfb2cc 100644 --- a/indra/newview/llworld.h +++ b/indra/newview/llworld.h @@ -199,7 +199,7 @@ private: // Data for "Fake" objects // - std::list<LLVOWater*> mHoleWaterObjects; + std::list<LLPointer<LLVOWater> > mHoleWaterObjects; LLPointer<LLVOWater> mEdgeWaterObjects[8]; LLPointer<LLViewerTexture> mDefaultWaterTexturep; |