summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2020-02-04 13:12:38 +0000
committerAndrey Kleshchev <andreykproductengine@lindenlab.com>2020-02-04 13:12:38 +0000
commit0e7ab122ec0761ca0a82251d63a7367e7147f4be (patch)
treee0c1d1e1307f55b5de30e880d2ac4a0f4aa09deb
parent98f4cd3434d8f3524b114cccad9cb4e888d76332 (diff)
SL-10908 LLFace should fully rely onto drawable
-rw-r--r--indra/newview/llface.cpp12
-rw-r--r--indra/newview/llface.h9
2 files changed, 13 insertions, 8 deletions
diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp
index 85ee33edb1..5539cfb5df 100644
--- a/indra/newview/llface.cpp
+++ b/indra/newview/llface.cpp
@@ -183,6 +183,7 @@ void LLFace::destroy()
if(mTexture[i].notNull())
{
mTexture[i]->removeFace(i, this) ;
+ mTexture[i] = NULL;
}
}
@@ -202,7 +203,6 @@ void LLFace::destroy()
{
mDrawPoolp->removeFace(this);
}
-
mDrawPoolp = NULL;
}
@@ -211,7 +211,7 @@ void LLFace::destroy()
delete mTextureMatrix;
mTextureMatrix = NULL;
- if (mDrawablep.notNull())
+ if (mDrawablep)
{
LLSpatialGroup* group = mDrawablep->getSpatialGroup();
if (group)
@@ -223,7 +223,7 @@ void LLFace::destroy()
}
setDrawInfo(NULL);
-
+
mDrawablep = NULL;
mVObjp = NULL;
}
@@ -529,7 +529,7 @@ void LLFace::updateCenterAgent()
void LLFace::renderSelected(LLViewerTexture *imagep, const LLColor4& color)
{
- if (mDrawablep->getSpatialGroup() == NULL)
+ if (mDrawablep == NULL || mDrawablep->getSpatialGroup() == NULL)
{
return;
}
@@ -537,7 +537,7 @@ void LLFace::renderSelected(LLViewerTexture *imagep, const LLColor4& color)
mDrawablep->getSpatialGroup()->rebuildGeom();
mDrawablep->getSpatialGroup()->rebuildMesh();
- if(mDrawablep.isNull() || mVertexBuffer.isNull())
+ if(mVertexBuffer.isNull())
{
return;
}
@@ -2668,7 +2668,7 @@ S32 LLFace::renderElements(const U16 *index_array) const
S32 LLFace::renderIndexed()
{
- if(mDrawablep.isNull() || mDrawPoolp == NULL)
+ if(mDrawablep == NULL || mDrawPoolp == NULL)
{
return 0;
}
diff --git a/indra/newview/llface.h b/indra/newview/llface.h
index 77861f7d2f..fce7f71173 100644
--- a/indra/newview/llface.h
+++ b/indra/newview/llface.h
@@ -275,8 +275,13 @@ private:
LLXformMatrix* mXform;
LLPointer<LLViewerTexture> mTexture[LLRender::NUM_TEXTURE_CHANNELS];
-
- LLPointer<LLDrawable> mDrawablep;
+
+ // mDrawablep is not supposed to be null, don't use LLPointer because
+ // mDrawablep owns LLFace and LLPointer is a good way to either cause a
+ // memory leak or a 'delete each other' situation if something deletes
+ // drawable wrongly.
+ LLDrawable* mDrawablep;
+ // LLViewerObject technically owns drawable, but also it should be strictly managed
LLPointer<LLViewerObject> mVObjp;
S32 mTEOffset;