Skip to content
Snippets Groups Projects
Commit 6a812fa1 authored by Brad Linden's avatar Brad Linden
Browse files

Improved fix for SL-19675 crash. How about just don't refer to data when you don't need it

parent 3513f67d
No related branches found
No related tags found
2 merge requests!3Update to main branch,!2Rebase onto current main branch
......@@ -167,6 +167,7 @@ class LLGLTFMaterial : public LLRefCount
// 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
......
......@@ -227,16 +227,16 @@ class LLGLTFMaterialOverrideDispatchHandler : public LLDispatchHandler
// 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 @@ class LLGLTFMaterialOverrideDispatchHandler : public LLDispatchHandler
}
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 @@ class LLGLTFMaterialOverrideDispatchHandler : public LLDispatchHandler
// 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 @@ class LLGLTFMaterialOverrideDispatchHandler : public LLDispatchHandler
obj->setTEGLTFMaterialOverride(i, nullptr);
if (obj->getTE(i) && obj->getTE(i)->isSelected())
{
doSelectionCallbacks(object_override.mObjectId, i);
doSelectionCallbacks(object_id, i);
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment