FIRE-34496 - additional fixes
Previous fix was not correct. The underlying issue is that the cached `mAvatar` pointer is being invalidated and as a result crashing. using avatarp instead avoids this and removes the awkward cached pointer. Might need to review if the previous reason for mAvatar reappears.master
parent
2673522b20
commit
ec9e5f06ec
|
|
@ -111,7 +111,6 @@ S32 cube_channel = -1;
|
|||
|
||||
LLDrawPoolAvatar::LLDrawPoolAvatar(U32 type) :
|
||||
LLFacePool(type)
|
||||
, mAvatar(nullptr) // <FS:Zi> Add avatar hitbox debug - remember avatar pointer in case avatar draw face breaks
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -691,9 +690,37 @@ void LLDrawPoolAvatar::renderAvatars(LLVOAvatar* single_avatar, S32 pass)
|
|||
return;
|
||||
}
|
||||
|
||||
|
||||
if (mDrawFace.empty() && !single_avatar)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
LLVOAvatar *avatarp { nullptr };
|
||||
|
||||
if (single_avatar)
|
||||
{
|
||||
avatarp = single_avatar;
|
||||
}
|
||||
else
|
||||
{
|
||||
LL_PROFILE_ZONE_NAMED_CATEGORY_AVATAR("Find avatarp"); // <FS:Beq/> Tracy markup
|
||||
const LLFace *facep = mDrawFace[0];
|
||||
if (!facep || !facep->getDrawable()) // <FS:Beq/> trap possible null dereference
|
||||
{
|
||||
return;
|
||||
}
|
||||
avatarp = (LLVOAvatar *)facep->getDrawable()->getVObj().get();
|
||||
}
|
||||
|
||||
if (!avatarp || avatarp->isDead() || avatarp->mDrawable.isNull()) // <FS:Beq/> trap possible null dereference
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// <FS:Zi> Add avatar hitbox debug
|
||||
static LLCachedControl<bool> render_hitbox(gSavedSettings, "DebugRenderHitboxes", false);
|
||||
if (render_hitbox && pass == 2 && (single_avatar || mAvatar) && !mAvatar->isControlAvatar())
|
||||
if (render_hitbox && pass == 2 && !avatarp->isControlAvatar())
|
||||
{
|
||||
LL_PROFILE_ZONE_NAMED_CATEGORY_AVATAR("render_hitbox");
|
||||
|
||||
|
|
@ -705,13 +732,13 @@ void LLDrawPoolAvatar::renderAvatars(LLVOAvatar* single_avatar, S32 pass)
|
|||
LLGLEnable blend(GL_BLEND);
|
||||
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
|
||||
|
||||
LLColor4 avatar_color = LLNetMap::getAvatarColor(mAvatar->getID());
|
||||
LLColor4 avatar_color = LLNetMap::getAvatarColor(avatarp->getID());
|
||||
gGL.diffuseColor4f(avatar_color.mV[VRED], avatar_color.mV[VGREEN], avatar_color.mV[VBLUE], avatar_color.mV[VALPHA]);
|
||||
gGL.setLineWidth(2.0f);
|
||||
|
||||
const LLQuaternion& rot = mAvatar->getRotationRegion();
|
||||
const LLVector3& pos = mAvatar->getPositionAgent();
|
||||
const LLVector3& size = mAvatar->getScale();
|
||||
const LLQuaternion& rot = avatarp->getRotationRegion();
|
||||
const LLVector3& pos = avatarp->getPositionAgent();
|
||||
const LLVector3& size = avatarp->getScale();
|
||||
|
||||
// drawBoxOutline partly copied from llspatialpartition.cpp below
|
||||
|
||||
|
|
@ -768,34 +795,6 @@ void LLDrawPoolAvatar::renderAvatars(LLVOAvatar* single_avatar, S32 pass)
|
|||
}
|
||||
}
|
||||
// </FS:Zi>
|
||||
|
||||
if (mDrawFace.empty() && !single_avatar)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
LLVOAvatar *avatarp { nullptr };
|
||||
|
||||
if (single_avatar)
|
||||
{
|
||||
avatarp = single_avatar;
|
||||
}
|
||||
else
|
||||
{
|
||||
LL_PROFILE_ZONE_NAMED_CATEGORY_AVATAR("Find avatarp"); // <FS:Beq/> Tracy markup
|
||||
const LLFace *facep = mDrawFace[0];
|
||||
if (!facep || !facep->getDrawable()) // <FS:Beq/> trap possible null dereference
|
||||
{
|
||||
return;
|
||||
}
|
||||
avatarp = (LLVOAvatar *)facep->getDrawable()->getVObj().get();
|
||||
}
|
||||
|
||||
if (!avatarp || avatarp->isDead() || avatarp->mDrawable.isNull()) // <FS:Beq/> trap possible null dereference
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// <FS:Beq> rendertime Tracy annotations
|
||||
{
|
||||
LL_PROFILE_ZONE_NAMED_CATEGORY_AVATAR("check fully_loaded");
|
||||
|
|
|
|||
|
|
@ -121,8 +121,6 @@ typedef enum
|
|||
|
||||
void renderAvatars(LLVOAvatar *single_avatar, S32 pass = -1); // renders only one avatar if single_avatar is not null.
|
||||
|
||||
LLVOAvatar* mAvatar; // <FS:Zi> Add avatar hitbox debug - remember avatar pointer in case avatar draw face breaks
|
||||
|
||||
static bool sSkipOpaque;
|
||||
static bool sSkipTransparent;
|
||||
static S32 sShadowPass;
|
||||
|
|
|
|||
|
|
@ -8056,7 +8056,6 @@ LLDrawable *LLVOAvatar::createDrawable(LLPipeline *pipeline)
|
|||
mNumInitFaces = mDrawable->getNumFaces() ;
|
||||
|
||||
dirtyMesh(2);
|
||||
poolp->mAvatar = this; // <FS:Zi> Add avatar hitbox debug - remember avatar pointer in case avatar draw face breaks
|
||||
return mDrawable;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue