diff options
author | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2024-11-22 18:59:12 +0200 |
---|---|---|
committer | Andrey Kleshchev <117672381+akleshchev@users.noreply.github.com> | 2024-11-22 20:58:50 +0200 |
commit | bedf884cafee5529f011a5b47aa403fa48d27227 (patch) | |
tree | 93f98a514442ca840c3b43d1c194f2e16eb48c25 /indra/newview | |
parent | 97f0a21421940677f02b353036a20bc643f32073 (diff) |
viewer#3133 Callback related crash in LLViewerFetchedTexture
Seems to be realted to LLModelPreview and path generated textures so I'm
improving cleanup.
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llmodelpreview.cpp | 9 | ||||
-rw-r--r-- | indra/newview/llmodelpreview.h | 1 |
2 files changed, 6 insertions, 4 deletions
diff --git a/indra/newview/llmodelpreview.cpp b/indra/newview/llmodelpreview.cpp index 1e7da126b0..d61333c2cc 100644 --- a/indra/newview/llmodelpreview.cpp +++ b/indra/newview/llmodelpreview.cpp @@ -227,6 +227,8 @@ LLModelPreview::~LLModelPreview() } mBaseModel.clear(); mBaseScene.clear(); + + LLLoadedCallbackEntry::cleanUpCallbackList(&mCallbackTextureList); } void LLModelPreview::updateDimentionsAndOffsets() @@ -553,7 +555,7 @@ void LLModelPreview::rebuildUploadData() { // in case user provided a missing file later texture->setIsMissingAsset(false); - texture->setLoadedCallback(LLModelPreview::textureLoadedCallback, 0, true, false, this, NULL, false); + texture->setLoadedCallback(LLModelPreview::textureLoadedCallback, 0, true, false, this, &mCallbackTextureList, false); texture->forceToSaveRawImage(0, F32_MAX); texture->updateFetch(); if (mModelLoader) @@ -3130,8 +3132,6 @@ LLJoint* LLModelPreview::lookupJointByName(const std::string& str, void* opaque) U32 LLModelPreview::loadTextures(LLImportMaterial& material, void* opaque) { - (void)opaque; - if (material.mDiffuseMapFilename.size()) { material.mOpaqueData = new LLPointer< LLViewerFetchedTexture >; @@ -3145,7 +3145,8 @@ U32 LLModelPreview::loadTextures(LLImportMaterial& material, void* opaque) } // Todo: might cause a crash if preview gets closed before we get the callback. // Use a callback list or guard callback in some way - tex->setLoadedCallback(LLModelPreview::textureLoadedCallback, 0, true, false, opaque, NULL, false); + LLModelPreview* preview = (LLModelPreview*)opaque; + tex->setLoadedCallback(LLModelPreview::textureLoadedCallback, 0, true, false, opaque, &preview->mCallbackTextureList, false); tex->forceToSaveRawImage(0, F32_MAX); material.setDiffuseMap(tex->getID()); // record tex ID return 1; diff --git a/indra/newview/llmodelpreview.h b/indra/newview/llmodelpreview.h index c615070105..e236d7ced7 100644 --- a/indra/newview/llmodelpreview.h +++ b/indra/newview/llmodelpreview.h @@ -316,6 +316,7 @@ protected: LLMeshUploadThread::instance_list mUploadData; std::set<LLViewerFetchedTexture * > mTextureSet; + LLLoadedCallbackEntry::source_callback_list_t mCallbackTextureList; //map of vertex buffers to models (one vertex buffer in vector per face in model std::map<LLModel*, std::vector<LLPointer<LLVertexBuffer> > > mVertexBuffer[LLModel::NUM_LODS + 1]; |