summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;