diff options
author | Xiaohong Bao <bao@lindenlab.com> | 2010-07-15 15:16:50 -0600 |
---|---|---|
committer | Xiaohong Bao <bao@lindenlab.com> | 2010-07-15 15:16:50 -0600 |
commit | 540e2d8e5d0c5ad9cecc68fd03f86335e96a9318 (patch) | |
tree | 76676705f304dc156472480a5d13a81cb781781a /indra | |
parent | 2d683ebf749ed153dcf3260e0f629252507ccd40 (diff) |
EXT-8301: FIXED: crash at LLViewerFetchedTexture::cleanup() [secondlife-bin llviewertexture.cpp]
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/lldrawpoolbump.cpp | 4 | ||||
-rw-r--r-- | indra/newview/llpreviewtexture.cpp | 4 | ||||
-rw-r--r-- | indra/newview/llviewertexture.cpp | 50 | ||||
-rw-r--r-- | indra/newview/llviewertexture.h | 16 | ||||
-rw-r--r-- | indra/newview/llviewertexturelist.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llvoavatar.cpp | 19 | ||||
-rw-r--r-- | indra/newview/llvoavatarself.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llwearable.cpp | 2 |
8 files changed, 48 insertions, 51 deletions
diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp index 68809b0926..c206daf89b 100644 --- a/indra/newview/lldrawpoolbump.cpp +++ b/indra/newview/lldrawpoolbump.cpp @@ -149,7 +149,7 @@ void LLStandardBumpmap::restoreGL() 0, 0); gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mImage->setBoostLevel(LLViewerTexture::BOOST_BUMP) ; - gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mImage->setLoadedCallback(LLBumpImageList::onSourceStandardLoaded, 0, TRUE, FALSE, NULL, NULL, NULL ); + gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mImage->setLoadedCallback(LLBumpImageList::onSourceStandardLoaded, 0, TRUE, FALSE, NULL, NULL ); LLStandardBumpmap::sStandardBumpmapCount++; } @@ -923,7 +923,7 @@ LLViewerTexture* LLBumpImageList::getBrightnessDarknessImage(LLViewerFetchedText // Note: this may create an LLImageGL immediately src_image->setBoostLevel(LLViewerTexture::BOOST_BUMP) ; - src_image->setLoadedCallback( callback_func, 0, TRUE, FALSE, new LLUUID(src_image->getID()), NULL, NULL ); + src_image->setLoadedCallback( callback_func, 0, TRUE, FALSE, new LLUUID(src_image->getID()), NULL ); bump = (*entries_list)[src_image->getID()]; // In case callback was called immediately and replaced the image // bump_total++; diff --git a/indra/newview/llpreviewtexture.cpp b/indra/newview/llpreviewtexture.cpp index c4cbbbb791..7fdc5c8b5f 100644 --- a/indra/newview/llpreviewtexture.cpp +++ b/indra/newview/llpreviewtexture.cpp @@ -88,7 +88,7 @@ LLPreviewTexture::LLPreviewTexture(const LLSD& key) LLPreviewTexture::~LLPreviewTexture() { - LLLoadedCallbackEntry::cleanUpCallbackList(&mCallbackTextureList, this) ; + LLLoadedCallbackEntry::cleanUpCallbackList(&mCallbackTextureList) ; if( mLoadingFullImage ) { @@ -281,7 +281,7 @@ void LLPreviewTexture::saveAs() mLoadingFullImage = TRUE; getWindow()->incBusyCount(); mImage->setLoadedCallback( LLPreviewTexture::onFileLoadedForSave, - 0, TRUE, FALSE, new LLUUID( mItemUUID ), this, &mCallbackTextureList ); + 0, TRUE, FALSE, new LLUUID( mItemUUID ), &mCallbackTextureList ); } // virtual diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index 75bb9f84e2..928525244c 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -114,7 +114,6 @@ LLLoadedCallbackEntry::LLLoadedCallbackEntry(loaded_callback_func cb, BOOL need_imageraw, // Needs image raw for the callback void* userdata, LLLoadedCallbackEntry::source_callback_list_t* src_callback_list, - void* source, LLViewerFetchedTexture* target, BOOL pause) : mCallback(cb), @@ -123,7 +122,6 @@ LLLoadedCallbackEntry::LLLoadedCallbackEntry(loaded_callback_func cb, mNeedsImageRaw(need_imageraw), mUserData(userdata), mSourceCallbackList(src_callback_list), - mSource(source), mPaused(pause) { if(mSourceCallbackList) @@ -145,10 +143,10 @@ void LLLoadedCallbackEntry::removeTexture(LLViewerFetchedTexture* tex) } //static -void LLLoadedCallbackEntry::cleanUpCallbackList(LLLoadedCallbackEntry::source_callback_list_t* callback_list, void* src) +void LLLoadedCallbackEntry::cleanUpCallbackList(LLLoadedCallbackEntry::source_callback_list_t* callback_list) { //clear texture callbacks. - if(!callback_list->empty()) + if(callback_list && !callback_list->empty()) { for(LLLoadedCallbackEntry::source_callback_list_t::iterator iter = callback_list->begin(); iter != callback_list->end(); ++iter) @@ -156,7 +154,7 @@ void LLLoadedCallbackEntry::cleanUpCallbackList(LLLoadedCallbackEntry::source_ca LLViewerFetchedTexture* tex = gTextureList.findImage(*iter) ; if(tex) { - tex->deleteCallbackEntry(src) ; + tex->deleteCallbackEntry(callback_list) ; } } callback_list->clear() ; @@ -514,6 +512,7 @@ LLViewerTexture::LLViewerTexture(const LLImageRaw* raw, BOOL usemipmaps) LLViewerTexture::~LLViewerTexture() { + cleanup(); sImageCount--; } @@ -547,7 +546,6 @@ S8 LLViewerTexture::getType() const return LLViewerTexture::LOCAL_TEXTURE ; } -//virtual void LLViewerTexture::cleanup() { mFaceList.clear() ; @@ -1186,7 +1184,6 @@ S8 LLViewerFetchedTexture::getType() const return LLViewerTexture::FETCHED_TEXTURE ; } -//virtual void LLViewerFetchedTexture::cleanup() { for(callback_list_t::iterator iter = mLoadedCallbackList.begin(); @@ -1208,8 +1205,6 @@ void LLViewerFetchedTexture::cleanup() mCachedRawDiscardLevel = -1 ; mCachedRawImageReady = FALSE ; mSavedRawImage = NULL ; - - LLViewerTexture::cleanup(); } void LLViewerFetchedTexture::setForSculpt() @@ -2038,7 +2033,7 @@ void LLViewerFetchedTexture::setIsMissingAsset() } void LLViewerFetchedTexture::setLoadedCallback( loaded_callback_func loaded_callback, - S32 discard_level, BOOL keep_imageraw, BOOL needs_aux, void* userdata, void* src, + S32 discard_level, BOOL keep_imageraw, BOOL needs_aux, void* userdata, LLLoadedCallbackEntry::source_callback_list_t* src_callback_list, BOOL pause) { // @@ -2057,9 +2052,9 @@ void LLViewerFetchedTexture::setLoadedCallback( loaded_callback_func loaded_call if(mPauseLoadedCallBacks && !pause) { - unpauseLoadedCallbacks(src) ; + unpauseLoadedCallbacks(src_callback_list) ; } - LLLoadedCallbackEntry* entryp = new LLLoadedCallbackEntry(loaded_callback, discard_level, keep_imageraw, userdata, src_callback_list, src, this, pause); + LLLoadedCallbackEntry* entryp = new LLLoadedCallbackEntry(loaded_callback, discard_level, keep_imageraw, userdata, src_callback_list, this, pause); mLoadedCallbackList.push_back(entryp); mNeedsAux |= needs_aux; @@ -2074,9 +2069,9 @@ void LLViewerFetchedTexture::setLoadedCallback( loaded_callback_func loaded_call } } -void LLViewerFetchedTexture::deleteCallbackEntry(void* src) +void LLViewerFetchedTexture::deleteCallbackEntry(const LLLoadedCallbackEntry::source_callback_list_t* callback_list) { - if(mLoadedCallbackList.empty()) + if(mLoadedCallbackList.empty() || !callback_list) { return ; } @@ -2087,13 +2082,13 @@ void LLViewerFetchedTexture::deleteCallbackEntry(void* src) iter != mLoadedCallbackList.end(); ) { LLLoadedCallbackEntry *entryp = *iter; - if(entryp->mSource == src) + if(entryp->mSourceCallbackList == callback_list) { // We never finished loading the image. Indicate failure. // Note: this allows mLoadedCallbackUserData to be cleaned up. entryp->mCallback(FALSE, this, NULL, NULL, 0, TRUE, entryp->mUserData); - delete entryp; iter = mLoadedCallbackList.erase(iter) ; + delete entryp; } else { @@ -2132,14 +2127,20 @@ void LLViewerFetchedTexture::deleteCallbackEntry(void* src) } } -void LLViewerFetchedTexture::unpauseLoadedCallbacks(void* src) +void LLViewerFetchedTexture::unpauseLoadedCallbacks(const LLLoadedCallbackEntry::source_callback_list_t* callback_list) { + if(!callback_list) + { + mPauseLoadedCallBacks = FALSE ; + return ; + } + BOOL need_raw = FALSE ; for(callback_list_t::iterator iter = mLoadedCallbackList.begin(); iter != mLoadedCallbackList.end(); ) { LLLoadedCallbackEntry *entryp = *iter++; - if(entryp->mSource == src) + if(entryp->mSourceCallbackList == callback_list) { entryp->mPaused = FALSE ; if(entryp->mNeedsImageRaw) @@ -2155,15 +2156,20 @@ void LLViewerFetchedTexture::unpauseLoadedCallbacks(void* src) } } -void LLViewerFetchedTexture::pauseLoadedCallbacks(void* src) +void LLViewerFetchedTexture::pauseLoadedCallbacks(const LLLoadedCallbackEntry::source_callback_list_t* callback_list) { + if(!callback_list) + { + return ; + } + bool paused = true ; for(callback_list_t::iterator iter = mLoadedCallbackList.begin(); iter != mLoadedCallbackList.end(); ) { LLLoadedCallbackEntry *entryp = *iter++; - if(entryp->mSource == src) + if(entryp->mSourceCallbackList == callback_list) { entryp->mPaused = TRUE ; } @@ -2340,10 +2346,6 @@ bool LLViewerFetchedTexture::doLoadedCallbacks() BOOL final = mRawDiscardLevel <= entryp->mDesiredDiscard ? TRUE : FALSE; //llinfos << "Running callback for " << getID() << llendl; //llinfos << mRawImage->getWidth() << "x" << mRawImage->getHeight() << llendl; - if (final) - { - //llinfos << "Final!" << llendl; - } entryp->mLastUsedDiscard = mRawDiscardLevel; entryp->mCallback(TRUE, this, mRawImage, mAuxRawImage, mRawDiscardLevel, final, entryp->mUserData); if (final) diff --git a/indra/newview/llviewertexture.h b/indra/newview/llviewertexture.h index b33d04e8dd..1f0d760daf 100644 --- a/indra/newview/llviewertexture.h +++ b/indra/newview/llviewertexture.h @@ -75,7 +75,6 @@ public: BOOL need_imageraw, // Needs image raw for the callback void* userdata, source_callback_list_t* src_callback_list, - void* source, LLViewerFetchedTexture* target, BOOL pause); ~LLLoadedCallbackEntry(); @@ -88,10 +87,9 @@ public: BOOL mPaused; void* mUserData; source_callback_list_t* mSourceCallbackList; - void* mSource; public: - static void cleanUpCallbackList(LLLoadedCallbackEntry::source_callback_list_t* callback_list, void* src) ; + static void cleanUpCallbackList(LLLoadedCallbackEntry::source_callback_list_t* callback_list) ; }; class LLTextureBar; @@ -265,7 +263,7 @@ public: /*virtual*/ void updateBindStatsForTester() ; protected: - virtual void cleanup() ; + void cleanup() ; void init(bool firstinit) ; void reorganizeFaceList() ; void reorganizeVolumeList() ; @@ -387,13 +385,13 @@ public: // Set callbacks to get called when the image gets updated with higher // resolution versions. void setLoadedCallback(loaded_callback_func cb, - S32 discard_level, BOOL keep_imageraw, BOOL needs_aux, void* src, + S32 discard_level, BOOL keep_imageraw, BOOL needs_aux, void* userdata, LLLoadedCallbackEntry::source_callback_list_t* src_callback_list, BOOL pause = FALSE); bool hasCallbacks() { return mLoadedCallbackList.empty() ? false : true; } - void pauseLoadedCallbacks(void* src); - void unpauseLoadedCallbacks(void* src); + void pauseLoadedCallbacks(const LLLoadedCallbackEntry::source_callback_list_t* callback_list); + void unpauseLoadedCallbacks(const LLLoadedCallbackEntry::source_callback_list_t* callback_list); bool doLoadedCallbacks(); - void deleteCallbackEntry(void* src); + void deleteCallbackEntry(const LLLoadedCallbackEntry::source_callback_list_t* callback_list); void addToCreateTexture(); @@ -488,7 +486,7 @@ protected: private: void init(bool firstinit) ; - /*virtual*/ void cleanup() ; + void cleanup() ; void saveRawImage() ; void setCachedRawImage() ; diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp index f2a3839f97..31f0998fab 100644 --- a/indra/newview/llviewertexturelist.cpp +++ b/indra/newview/llviewertexturelist.cpp @@ -1411,7 +1411,7 @@ LLUIImagePtr LLUIImageList::loadUIImage(LLViewerFetchedTexture* imagep, const st datap->mImageName = name; datap->mImageScaleRegion = scale_rect; - imagep->setLoadedCallback(onUIImageLoaded, 0, FALSE, FALSE, datap, NULL, NULL); + imagep->setLoadedCallback(onUIImageLoaded, 0, FALSE, FALSE, datap, NULL); } return new_imagep; } diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 07b98eaf82..53b47ec408 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -835,6 +835,7 @@ LLVOAvatar::~LLVOAvatar() mDead = TRUE; mAnimationSources.clear(); + LLLoadedCallbackEntry::cleanUpCallbackList(&mCallbackTextureList) ; lldebugs << "LLVOAvatar Destructor end" << llendl; } @@ -848,7 +849,7 @@ void LLVOAvatar::markDead() sNumVisibleChatBubbles--; } mVoiceVisualizer->markDead(); - LLLoadedCallbackEntry::cleanUpCallbackList(&mCallbackTextureList, this) ; + LLLoadedCallbackEntry::cleanUpCallbackList(&mCallbackTextureList) ; LLViewerObject::markDead(); } @@ -4255,13 +4256,13 @@ void LLVOAvatar::checkTextureLoading() { if(pause)//pause texture fetching. { - tex->pauseLoadedCallbacks(this) ; + tex->pauseLoadedCallbacks(&mCallbackTextureList) ; } else//unpause { static const F32 START_AREA = 100.f ; - tex->unpauseLoadedCallbacks(this) ; + tex->unpauseLoadedCallbacks(&mCallbackTextureList) ; tex->addTextureStats(START_AREA); //jump start the fetching again } } @@ -6210,11 +6211,9 @@ void LLVOAvatar::updateMeshTextures() const BOOL self_customizing = isSelf() && gAgentCamera.cameraCustomizeAvatar(); // During face edit mode, we don't use baked textures const BOOL other_culled = !isSelf() && mCulled; LLLoadedCallbackEntry::source_callback_list_t* src_callback_list = NULL ; - void* callback_src = NULL ; BOOL paused = FALSE; if(!isSelf()) { - callback_src = this ; src_callback_list = &mCallbackTextureList ; paused = mLoadedCallbacksPaused ; } @@ -6290,10 +6289,10 @@ void LLVOAvatar::updateMeshTextures() if ( (baked_img->getID() != IMG_INVISIBLE) && ((i == BAKED_HEAD) || (i == BAKED_UPPER) || (i == BAKED_LOWER)) ) { baked_img->setLoadedCallback(onBakedTextureMasksLoaded, MORPH_MASK_REQUESTED_DISCARD, TRUE, TRUE, new LLTextureMaskData( mID ), - callback_src, src_callback_list, paused); + src_callback_list, paused); } baked_img->setLoadedCallback(onBakedTextureLoaded, SWITCH_TO_BAKED_DISCARD, FALSE, FALSE, new LLUUID( mID ), - callback_src, src_callback_list, paused ); + src_callback_list, paused ); } } else if (mBakedTextureDatas[i].mTexLayerSet @@ -6754,11 +6753,9 @@ void LLVOAvatar::onFirstTEMessageReceived() mFirstTEMessageReceived = TRUE; LLLoadedCallbackEntry::source_callback_list_t* src_callback_list = NULL ; - void* callback_src = NULL ; BOOL paused = FALSE ; if(!isSelf()) { - callback_src = this ; src_callback_list = &mCallbackTextureList ; paused = mLoadedCallbacksPaused ; } @@ -6777,10 +6774,10 @@ void LLVOAvatar::onFirstTEMessageReceived() if ( (image->getID() != IMG_INVISIBLE) && ((i == BAKED_HEAD) || (i == BAKED_UPPER) || (i == BAKED_LOWER)) ) { image->setLoadedCallback( onBakedTextureMasksLoaded, MORPH_MASK_REQUESTED_DISCARD, TRUE, TRUE, new LLTextureMaskData( mID ), - callback_src, src_callback_list, paused); + src_callback_list, paused); } image->setLoadedCallback( onInitialBakedTextureLoaded, MAX_DISCARD_LEVEL, FALSE, FALSE, new LLUUID( mID ), - callback_src, src_callback_list, paused ); + src_callback_list, paused ); } } diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index b80e47e11a..8961d2c285 100644 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -1633,7 +1633,7 @@ void LLVOAvatarSelf::setLocalTexture(ETextureIndex type, LLViewerTexture* src_te } else { - tex->setLoadedCallback(onLocalTextureLoaded, desired_discard, TRUE, FALSE, new LLAvatarTexData(getID(), type), NULL, NULL); + tex->setLoadedCallback(onLocalTextureLoaded, desired_discard, TRUE, FALSE, new LLAvatarTexData(getID(), type), NULL); } } tex->setMinDiscardLevel(desired_discard); diff --git a/indra/newview/llwearable.cpp b/indra/newview/llwearable.cpp index ec9c78ee53..401e2cdb1b 100644 --- a/indra/newview/llwearable.cpp +++ b/indra/newview/llwearable.cpp @@ -445,7 +445,7 @@ BOOL LLWearable::importFile( LLFILE* file ) } image->setBoostLevel(LLViewerTexture::BOOST_AVATAR_SELF) ; - image->setLoadedCallback(LLVOAvatarSelf::debugOnTimingLocalTexLoaded,0,TRUE,FALSE, new LLVOAvatarSelf::LLAvatarTexData(id, (LLVOAvatarDefines::ETextureIndex)te), NULL, NULL); + image->setLoadedCallback(LLVOAvatarSelf::debugOnTimingLocalTexLoaded,0,TRUE,FALSE, new LLVOAvatarSelf::LLAvatarTexData(id, (LLVOAvatarDefines::ETextureIndex)te), NULL); LLUUID textureid(text_buffer); mTEMap[te] = new LLLocalTextureObject(image, textureid); |