diff options
author | Xiaohong Bao <bao@lindenlab.com> | 2009-10-03 00:23:01 +0000 |
---|---|---|
committer | Xiaohong Bao <bao@lindenlab.com> | 2009-10-03 00:23:01 +0000 |
commit | b1a280841e1823a19658923a8eefeb67d1d70735 (patch) | |
tree | 46fe90cf2f37fc21d86fd7a599e6120d7de396ea | |
parent | a6db5fa24e99a4cca00c67708621a3ceffcec8a6 (diff) |
fix for DEV-40559: viewer crash when media texture appears while parcel media is loading.
-rw-r--r-- | indra/newview/llface.cpp | 10 | ||||
-rw-r--r-- | indra/newview/llviewertexture.cpp | 24 |
2 files changed, 29 insertions, 5 deletions
diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index a5b0b05603..b0ae13348b 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -272,12 +272,12 @@ void LLFace::setTexture(LLViewerTexture* tex) removeAtlas() ; } - mTexture = tex ; - - if(mTexture.notNull()) + if(tex) { - mTexture->addFace(this) ; - } + tex->addFace(this) ; + } + + mTexture = tex ; } void LLFace::switchTexture(LLViewerTexture* new_texture) diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index a2f6b70006..9f096209dd 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -2348,6 +2348,14 @@ void LLViewerMediaTexture::addFace(LLFace* facep) return ; } } + + //check if it is a parcel media + if(facep->getTexture() && facep->getTexture() != this && facep->getTexture()->getID() == mID) + { + mTextureList.push_back(facep->getTexture()) ; //a parcel media. + return ; + } + llerrs << "The face does not have a valid texture before media texture." << llendl ; } @@ -2406,6 +2414,18 @@ void LLViewerMediaTexture::removeFace(LLFace* facep) } } } + + //check if it is a parcel media + for(std::list< LLPointer<LLViewerTexture> >::iterator iter = mTextureList.begin(); + iter != mTextureList.end(); ++iter) + { + if((*iter)->getID() == mID) + { + mTextureList.erase(iter) ; //decrease the reference number for tex by one. + return ; + } + } + llerrs << "mTextureList texture reference number is corrupted." << llendl ; } @@ -2442,6 +2462,10 @@ void LLViewerMediaTexture::switchTexture(LLFace* facep) if(te) { LLViewerTexture* tex = gTextureList.findImage(te->getID()) ; + if(!tex && te->getID() != mID)//try parcel media. + { + tex = gTextureList.findImage(mID) ; + } facep->switchTexture(tex) ; } } |