From 164de6c1807a5517cbd2ccf7d16b536aa333e64a Mon Sep 17 00:00:00 2001
From: Xiaohong Bao <bao@lindenlab.com>
Date: Fri, 27 Apr 2012 18:32:42 -0600
Subject: [PATCH] fix for a crash on sculpt

---
 indra/llrender/llimagegl.cpp      | 4 ++--
 indra/newview/llviewertexture.cpp | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp
index ab744fb7ff7..bd9953e4182 100755
--- a/indra/llrender/llimagegl.cpp
+++ b/indra/llrender/llimagegl.cpp
@@ -1464,10 +1464,10 @@ void LLImageGL::destroyGLTexture()
 		}
 		
 		LLImageGL::deleteTextures(1, &mTexName);			
-		mTexName = 0;
-		mCurrentDiscardLevel = -1 ; //invalidate mCurrentDiscardLevel.
+		mTexName = 0;		
 		mGLTextureCreated = FALSE ;
 	}
+	mCurrentDiscardLevel = -1 ; //invalidate mCurrentDiscardLevel.
 }
 
 
diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp
index 1b468a7b96d..f27e20c2a20 100644
--- a/indra/newview/llviewertexture.cpp
+++ b/indra/newview/llviewertexture.cpp
@@ -1146,7 +1146,7 @@ S32  LLViewerTexture::getDiscardLevelInAtlas() const
 
 void LLViewerTexture::destroyGLTexture() 
 {
-	if(mGLTexturep.notNull() && mGLTexturep->getHasGLTexture())
+	if(mGLTexturep.notNull())
 	{
 		mGLTexturep->destroyGLTexture() ;
 		mTextureState = DELETED ;	
-- 
GitLab