diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp index 9c2a66dd6191a0c340b67cb9e3c8a9bb9126a46d..710f383c305a8fd6eeee5216abee6b448e84c73a 100644 --- a/indra/newview/llviewerobjectlist.cpp +++ b/indra/newview/llviewerobjectlist.cpp @@ -1383,8 +1383,13 @@ BOOL LLViewerObjectList::killObject(LLViewerObject *objectp) // When we're killing objects, all we do is mark them as dead. // We clean up the dead objects later. - - 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; }