diff options
author | Brad Linden <brad@lindenlab.com> | 2023-05-03 13:23:05 -0700 |
---|---|---|
committer | Brad Linden <brad@lindenlab.com> | 2023-05-03 13:30:33 -0700 |
commit | 6a812fa1ba9170ba34706d303913cc5aa5f187ac (patch) | |
tree | f6573223b451b0c21014ff37beb5a6dfa912e75c /indra | |
parent | 3513f67d2c5628eac2ce9aa632a8491bb215a9e8 (diff) |
Improved fix for SL-19675 crash. How about just don't refer to data when you don't need it
Diffstat (limited to 'indra')
-rw-r--r-- | indra/llprimitive/llgltfmaterial.h | 1 | ||||
-rw-r--r-- | indra/newview/llgltfmateriallist.cpp | 18 |
2 files changed, 10 insertions, 9 deletions
diff --git a/indra/llprimitive/llgltfmaterial.h b/indra/llprimitive/llgltfmaterial.h index 0bd65fadef..ad7784f6d1 100644 --- a/indra/llprimitive/llgltfmaterial.h +++ b/indra/llprimitive/llgltfmaterial.h @@ -167,6 +167,7 @@ public: // set the contents of this LLGLTFMaterial from the given json // returns true if successful + // if unsuccessful, the contents of this LLGLTFMaterial should be left unchanged and false is returned // json - the json text to load from // warn_msg - warning message from TinyGLTF if any // error_msg - error_msg from TinyGLTF if any diff --git a/indra/newview/llgltfmateriallist.cpp b/indra/newview/llgltfmateriallist.cpp index 7d677626ce..1e49ea2eba 100644 --- a/indra/newview/llgltfmateriallist.cpp +++ b/indra/newview/llgltfmateriallist.cpp @@ -227,16 +227,16 @@ public: // fromJson() is performance heavy offload to a thread. main_queue->postTo( general_queue, - [object_override]() // Work done on general queue + [sides=object_override.mSides]() // Work done on general queue { std::vector<ReturnData> results; - if (!object_override.mSides.empty()) + if (!sides.empty()) { - results.reserve(object_override.mSides.size()); + results.reserve(sides.size()); // parse json - std::unordered_map<S32, std::string>::const_iterator iter = object_override.mSides.begin(); - std::unordered_map<S32, std::string>::const_iterator end = object_override.mSides.end(); + std::unordered_map<S32, std::string>::const_iterator iter = sides.begin(); + std::unordered_map<S32, std::string>::const_iterator end = sides.end(); while (iter != end) { std::string warn_msg, error_msg; @@ -259,9 +259,9 @@ public: } return results; }, - [object_override, this](std::vector<ReturnData> results) // Callback to main thread + [object_id=object_override.mObjectId, this](std::vector<ReturnData> results) // Callback to main thread { - LLViewerObject * obj = gObjectList.findObject(object_override.mObjectId); + LLViewerObject * obj = gObjectList.findObject(object_id); if (results.size() > 0 ) { @@ -287,7 +287,7 @@ public: // unblock material editor if (obj && obj->getTE(side) && obj->getTE(side)->isSelected()) { - doSelectionCallbacks(object_override.mObjectId, side); + doSelectionCallbacks(object_id, side); } } @@ -300,7 +300,7 @@ public: obj->setTEGLTFMaterialOverride(i, nullptr); if (obj->getTE(i) && obj->getTE(i)->isSelected()) { - doSelectionCallbacks(object_override.mObjectId, i); + doSelectionCallbacks(object_id, i); } } } |