Fixed some 'RenderDelayCreation' related crashes

This commit is contained in:
Shyotl
2011-03-27 16:53:17 -05:00
parent b887d3147e
commit 8323a701e8
6 changed files with 32 additions and 31 deletions

View File

@@ -405,7 +405,7 @@ LLObjectSelectionHandle LLSelectMgr::selectObjectAndFamily(LLViewerObject* obj,
} }
// Collect all of the objects // Collect all of the objects
LLDynamicArray<LLViewerObject*> objects; std::vector<LLViewerObject*> objects;
root->addThisAndNonJointChildren(objects); root->addThisAndNonJointChildren(objects);
addAsFamily(objects, add_to_end); addAsFamily(objects, add_to_end);
@@ -451,7 +451,7 @@ LLObjectSelectionHandle LLSelectMgr::selectObjectAndFamily(const std::vector<LLV
BOOL send_to_sim) BOOL send_to_sim)
{ {
// Collect all of the objects, children included // Collect all of the objects, children included
LLDynamicArray<LLViewerObject*> objects; std::vector<LLViewerObject*> objects;
//clear primary object (no primary object) //clear primary object (no primary object)
mSelectedObjects->mPrimaryObject = NULL; mSelectedObjects->mPrimaryObject = NULL;
@@ -575,7 +575,7 @@ void LLSelectMgr::deselectObjectAndFamily(LLViewerObject* object, BOOL send_to_s
if(!object->isSelected()) return; if(!object->isSelected()) return;
// Collect all of the objects, and remove them // Collect all of the objects, and remove them
LLDynamicArray<LLViewerObject*> objects; std::vector<LLViewerObject*> objects;
if (include_entire_object) if (include_entire_object)
{ {
@@ -821,7 +821,7 @@ LLObjectSelectionHandle LLSelectMgr::setHoverObject(LLViewerObject *objectp, S32
{ {
// Collect all of the objects // Collect all of the objects
LLDynamicArray<LLViewerObject*> objects; std::vector<LLViewerObject*> objects;
objectp = objectp->getRootEdit(); objectp = objectp->getRootEdit();
objectp->addThisAndNonJointChildren(objects); objectp->addThisAndNonJointChildren(objects);
@@ -1310,7 +1310,7 @@ void LLSelectMgr::promoteSelectionToRoot()
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void LLSelectMgr::demoteSelectionToIndividuals() void LLSelectMgr::demoteSelectionToIndividuals()
{ {
LLDynamicArray<LLViewerObject*> objects; std::vector<LLViewerObject*> objects;
for (LLObjectSelection::root_iterator iter = getSelection()->root_begin(); for (LLObjectSelection::root_iterator iter = getSelection()->root_begin();
iter != getSelection()->root_end(); iter++) iter != getSelection()->root_end(); iter++)
@@ -1319,7 +1319,7 @@ void LLSelectMgr::demoteSelectionToIndividuals()
object->addThisAndNonJointChildren(objects); object->addThisAndNonJointChildren(objects);
} }
if (objects.getLength()) if (!objects.empty())
{ {
deselectAll(); deselectAll();
for (std::vector<LLViewerObject*>::iterator iter = objects.begin(); for (std::vector<LLViewerObject*>::iterator iter = objects.begin();
@@ -3602,7 +3602,7 @@ void LLSelectMgr::sendAttach(U8 attachment_point)
{ {
LLViewerObject* attach_object = mSelectedObjects->getFirstRootObject(); LLViewerObject* attach_object = mSelectedObjects->getFirstRootObject();
if (!attach_object || !gAgent.getAvatarObject() || mSelectedObjects->mSelectType != SELECT_TYPE_WORLD) if (!attach_object || !isAgentAvatarValid() || mSelectedObjects->mSelectType != SELECT_TYPE_WORLD)
{ {
return; return;
} }
@@ -4886,7 +4886,7 @@ void LLSelectMgr::updateSelectionSilhouette(LLObjectSelectionHandle object_handl
generateSilhouette(node, LLViewerCamera::getInstance()->getOrigin()); generateSilhouette(node, LLViewerCamera::getInstance()->getOrigin());
changed_objects.push_back(objectp); changed_objects.push_back(objectp);
} }
else if (objectp->isAttachment()) else if (objectp->isAttachment() && objectp->getRootEdit() && objectp->getRootEdit()->mDrawable.notNull())
{ {
//RN: hack for orthogonal projection of HUD attachments //RN: hack for orthogonal projection of HUD attachments
LLViewerJointAttachment* attachment_pt = (LLViewerJointAttachment*)objectp->getRootEdit()->mDrawable->getParent(); LLViewerJointAttachment* attachment_pt = (LLViewerJointAttachment*)objectp->getRootEdit()->mDrawable->getParent();
@@ -4914,9 +4914,9 @@ void LLSelectMgr::renderSilhouettes(BOOL for_hud)
LLGLEnable blend(GL_BLEND); LLGLEnable blend(GL_BLEND);
LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE); LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE);
LLVOAvatar* avatar = gAgent.getAvatarObject(); if (isAgentAvatarValid() && for_hud)
if (for_hud && avatar)
{ {
LLVOAvatar* avatar = gAgent.getAvatarObject();
LLBBox hud_bbox = avatar->getHUDBBox(); LLBBox hud_bbox = avatar->getHUDBBox();
F32 cur_zoom = gAgent.mHUDCurZoom; F32 cur_zoom = gAgent.mHUDCurZoom;
@@ -5010,7 +5010,7 @@ void LLSelectMgr::renderSilhouettes(BOOL for_hud)
} }
} }
if (for_hud && avatar) if (isAgentAvatarValid() && for_hud)
{ {
glMatrixMode(GL_PROJECTION); glMatrixMode(GL_PROJECTION);
glPopMatrix(); glPopMatrix();
@@ -5372,7 +5372,7 @@ void LLSelectNode::renderOneSilhouette(const LLColor4 &color)
if (volume) if (volume)
{ {
F32 silhouette_thickness; F32 silhouette_thickness;
if (is_hud_object && gAgent.getAvatarObject()) if (isAgentAvatarValid() && is_hud_object)
{ {
silhouette_thickness = LLSelectMgr::sHighlightThickness / gAgent.mHUDCurZoom; silhouette_thickness = LLSelectMgr::sHighlightThickness / gAgent.mHUDCurZoom;
} }
@@ -5567,7 +5567,7 @@ void LLSelectMgr::updateSelectionCenter()
{ {
mSelectedObjects->mSelectType = getSelectTypeForObject(object); mSelectedObjects->mSelectType = getSelectTypeForObject(object);
if (mSelectedObjects->mSelectType == SELECT_TYPE_ATTACHMENT && gAgent.getAvatarObject()) if (mSelectedObjects->mSelectType == SELECT_TYPE_ATTACHMENT && isAgentAvatarValid())
{ {
mPauseRequest = gAgent.getAvatarObject()->requestPause(); mPauseRequest = gAgent.getAvatarObject()->requestPause();
} }
@@ -5576,7 +5576,7 @@ void LLSelectMgr::updateSelectionCenter()
mPauseRequest = NULL; mPauseRequest = NULL;
} }
if (mSelectedObjects->mSelectType != SELECT_TYPE_HUD && gAgent.getAvatarObject()) if (mSelectedObjects->mSelectType != SELECT_TYPE_HUD && isAgentAvatarValid())
{ {
// reset hud ZOOM // reset hud ZOOM
gAgent.mHUDTargetZoom = 1.f; gAgent.mHUDTargetZoom = 1.f;

View File

@@ -578,11 +578,11 @@ void LLViewerObject::removeChild(LLViewerObject *childp)
} }
} }
void LLViewerObject::addThisAndAllChildren(LLDynamicArray<LLViewerObject*>& objects) void LLViewerObject::addThisAndAllChildren(std::vector<LLViewerObject*>& objects)
{ {
objects.put(this); objects.push_back(this);
for (child_list_t::iterator iter = mChildList.begin(); for (child_list_t::iterator iter = mChildList.begin();
iter != mChildList.end(); iter++) iter != mChildList.end(); ++iter)
{ {
LLViewerObject* child = *iter; LLViewerObject* child = *iter;
if (!child->isAvatar()) if (!child->isAvatar())
@@ -592,16 +592,16 @@ void LLViewerObject::addThisAndAllChildren(LLDynamicArray<LLViewerObject*>& obje
} }
} }
void LLViewerObject::addThisAndNonJointChildren(LLDynamicArray<LLViewerObject*>& objects) void LLViewerObject::addThisAndNonJointChildren(std::vector<LLViewerObject*>& objects)
{ {
objects.put(this); objects.push_back(this);
// don't add any attachments when temporarily selecting avatar // don't add any attachments when temporarily selecting avatar
if (isAvatar()) if (isAvatar())
{ {
return; return;
} }
for (child_list_t::iterator iter = mChildList.begin(); for (child_list_t::iterator iter = mChildList.begin();
iter != mChildList.end(); iter++) iter != mChildList.end(); ++iter)
{ {
LLViewerObject* child = *iter; LLViewerObject* child = *iter;
if ( (!child->isAvatar()) && (!child->isJointChild())) if ( (!child->isAvatar()) && (!child->isJointChild()))
@@ -614,7 +614,7 @@ void LLViewerObject::addThisAndNonJointChildren(LLDynamicArray<LLViewerObject*>&
BOOL LLViewerObject::isChild(LLViewerObject *childp) const BOOL LLViewerObject::isChild(LLViewerObject *childp) const
{ {
for (child_list_t::const_iterator iter = mChildList.begin(); for (child_list_t::const_iterator iter = mChildList.begin();
iter != mChildList.end(); iter++) iter != mChildList.end(); ++iter)
{ {
LLViewerObject* testchild = *iter; LLViewerObject* testchild = *iter;
if (testchild == childp) if (testchild == childp)
@@ -628,7 +628,7 @@ BOOL LLViewerObject::isChild(LLViewerObject *childp) const
BOOL LLViewerObject::isSeat() const BOOL LLViewerObject::isSeat() const
{ {
for (child_list_t::const_iterator iter = mChildList.begin(); for (child_list_t::const_iterator iter = mChildList.begin();
iter != mChildList.end(); iter++) iter != mChildList.end(); ++iter)
{ {
LLViewerObject* child = *iter; LLViewerObject* child = *iter;
if (child->isAvatar()) if (child->isAvatar())
@@ -2914,7 +2914,8 @@ void LLViewerObject::updateSpatialExtents(LLVector3& newMin, LLVector3 &newMax)
LLVector3 size = getScale(); LLVector3 size = getScale();
newMin.setVec(center-size); newMin.setVec(center-size);
newMax.setVec(center+size); newMax.setVec(center+size);
mDrawable->setPositionGroup((newMin + newMax) * 0.5f); if(mDrawable.notNull())
mDrawable->setPositionGroup((newMin + newMax) * 0.5f);
} }
F32 LLViewerObject::getBinRadius() F32 LLViewerObject::getBinRadius()

View File

@@ -36,7 +36,6 @@
#include <map> #include <map>
#include "llassetstorage.h" #include "llassetstorage.h"
#include "lldarrayptr.h"
#include "llhudtext.h" #include "llhudtext.h"
#include "llhudicon.h" #include "llhudicon.h"
#include "llinventory.h" #include "llinventory.h"
@@ -243,8 +242,8 @@ public:
virtual void removeChild(LLViewerObject *childp); virtual void removeChild(LLViewerObject *childp);
const_child_list_t& getChildren() const { return mChildList; } const_child_list_t& getChildren() const { return mChildList; }
S32 numChildren() const { return mChildList.size(); } S32 numChildren() const { return mChildList.size(); }
void addThisAndAllChildren(LLDynamicArray<LLViewerObject*>& objects); void addThisAndAllChildren(std::vector<LLViewerObject*>& objects);
void addThisAndNonJointChildren(LLDynamicArray<LLViewerObject*>& objects); void addThisAndNonJointChildren(std::vector<LLViewerObject*>& objects);
BOOL isChild(LLViewerObject *childp) const; BOOL isChild(LLViewerObject *childp) const;
BOOL isSeat() const; BOOL isSeat() const;

View File

@@ -1585,7 +1585,7 @@ const LLVector3 LLVOAvatar::getRenderPosition() const
{ {
return getPositionAgent(); return getPositionAgent();
} }
else if (isRoot()) else if (isRoot() || !mDrawable->getParent())
{ {
return mDrawable->getPositionAgent(); return mDrawable->getPositionAgent();
} }
@@ -3029,7 +3029,7 @@ void LLVOAvatar::idleUpdateMisc(bool detailed_update)
mDrawable->movePartition(); mDrawable->movePartition();
//force a move if sitting on an active object //force a move if sitting on an active object
if (getParent() && ((LLViewerObject*) getParent())->mDrawable->isActive()) if (getParent() && ((LLViewerObject*)getParent())->mDrawable.notNull() && ((LLViewerObject*) getParent())->mDrawable->isActive())
{ {
gPipeline.markMoved(mDrawable, TRUE); gPipeline.markMoved(mDrawable, TRUE);
} }
@@ -7358,7 +7358,7 @@ BOOL LLVOAvatar::detachObject(LLViewerObject *viewer_object)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void LLVOAvatar::sitOnObject(LLViewerObject *sit_object) void LLVOAvatar::sitOnObject(LLViewerObject *sit_object)
{ {
if (!mDrawable || mDrawable.isNull()) if (!mDrawable || mDrawable.isNull() || sit_object->mDrawable.isNull())
{ {
return; return;
} }

View File

@@ -471,7 +471,7 @@ void LLVOVolume::updateTextureVirtualSize()
{ {
// Update the pixel area of all faces // Update the pixel area of all faces
if(!isVisible()) if(!isVisible() || mDrawable.isNull())
{ {
return; return;
} }

View File

@@ -1037,13 +1037,14 @@ void LLPipeline::unlinkDrawable(LLDrawable *drawable)
U32 LLPipeline::addObject(LLViewerObject *vobj) U32 LLPipeline::addObject(LLViewerObject *vobj)
{ {
llassert_always(vobj);
if (gNoRender) if (gNoRender)
{ {
return 0; return 0;
} }
static const LLCachedControl<bool> render_delay_creation("RenderDelayCreation",false); static const LLCachedControl<bool> render_delay_creation("RenderDelayCreation",false);
if (render_delay_creation) if (!vobj->isAvatar() && render_delay_creation)
{ {
mCreateQ.push_back(vobj); mCreateQ.push_back(vobj);
} }