From cf86c23dfe1fd732cd939b7fd48fdc7b88bdce1c Mon Sep 17 00:00:00 2001 From: Cosmic Linden <cosmic@lindenlab.com> Date: Tue, 29 Nov 2022 14:23:18 -0800 Subject: [PATCH] SL-18732: Pass material list callbacks by reference --- indra/newview/llgltfmateriallist.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/indra/newview/llgltfmateriallist.cpp b/indra/newview/llgltfmateriallist.cpp index 8142762dfe6..048085fb719 100644 --- a/indra/newview/llgltfmateriallist.cpp +++ b/indra/newview/llgltfmateriallist.cpp @@ -229,8 +229,6 @@ class LLGLTFMaterialOverrideDispatchHandler : public LLDispatchHandler bool mSuccess; }; - std::vector<void(*)(const LLUUID& object_id, S32 side)> callbacks = mCallbacks; - // fromJson() is performance heavy offload to a thread. main_queue->postTo( general_queue, @@ -270,7 +268,7 @@ class LLGLTFMaterialOverrideDispatchHandler : public LLDispatchHandler } return results; }, - [object_override, callbacks](std::vector<ReturnData> results) // Callback to main thread + [object_override, this](std::vector<ReturnData> results) // Callback to main thread { LLViewerObject * obj = gObjectList.findObject(object_override.mObjectId); @@ -293,7 +291,7 @@ class LLGLTFMaterialOverrideDispatchHandler : public LLDispatchHandler } else if (obj && obj->isAnySelected()) { - for (auto& override_update_callback : callbacks) + for (auto& override_update_callback : mCallbacks) { override_update_callback(object_override.mObjectId, results[i].mSide); } @@ -304,7 +302,7 @@ class LLGLTFMaterialOverrideDispatchHandler : public LLDispatchHandler // unblock material editor if (obj && obj->isAnySelected()) { - for (auto& override_update_callback : callbacks) + for (auto& override_update_callback : mCallbacks) { override_update_callback(object_override.mObjectId, results[i].mSide); } @@ -322,7 +320,7 @@ class LLGLTFMaterialOverrideDispatchHandler : public LLDispatchHandler obj->setTEGLTFMaterialOverride(i, nullptr); if (object_has_selection) { - for (auto& override_update_callback : callbacks) + for (auto& override_update_callback : mCallbacks) { override_update_callback(object_override.mObjectId, i); } @@ -339,7 +337,7 @@ class LLGLTFMaterialOverrideDispatchHandler : public LLDispatchHandler obj->setTEGLTFMaterialOverride(i, nullptr); if (object_has_selection) { - for (auto& override_update_callback : callbacks) + for (auto& override_update_callback : mCallbacks) { override_update_callback(obj->getID(), i); } -- GitLab