From 8d77d51e636f5384b0b024350a0a219e041b5446 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Mon, 15 Jul 2019 17:56:30 +0300 Subject: SL-10908 Safeguards and potential crash fix --- indra/newview/llcontrolavatar.cpp | 9 ++++++--- indra/newview/llsky.cpp | 2 +- indra/newview/llsurfacepatch.cpp | 2 +- indra/newview/llviewerobjectlist.cpp | 6 +++++- indra/newview/llworld.cpp | 4 ++-- indra/newview/llworld.h | 2 +- 6 files changed, 16 insertions(+), 9 deletions(-) (limited to 'indra') 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 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::iterator iter = mHoleWaterObjects.begin(); + for (std::list >::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 mHoleWaterObjects; + std::list > mHoleWaterObjects; LLPointer mEdgeWaterObjects[8]; LLPointer mDefaultWaterTexturep; -- cgit v1.2.3