summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorRunitaiLinden <davep@lindenlab.com>2024-04-29 12:40:42 -0500
committerGitHub <noreply@github.com>2024-04-29 10:40:42 -0700
commit66ccc1ed836948aa5d26b1ce0fcc1ae799e792a7 (patch)
tree7373de771316750942532ec8ffc423edd29513f1 /indra/newview
parent8465a8acb206bbdd839764446ac27e1116c58ee8 (diff)
#886 Fix for crash in LLBumpImageList when connecting to a simulator with different feature flags (#1345)
Diffstat (limited to 'indra/newview')
-rwxr-xr-xindra/newview/llviewerregion.cpp84
1 files changed, 50 insertions, 34 deletions
diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp
index fe1291c6f4..29dce088f5 100755
--- a/indra/newview/llviewerregion.cpp
+++ b/indra/newview/llviewerregion.cpp
@@ -2447,45 +2447,61 @@ void LLViewerRegion::setSimulatorFeatures(const LLSD& sim_features)
setSimulatorFeaturesReceived(true);
- // if region has MaxTextureResolution, set max_texture_dimension settings, otherwise use default
- if (mSimulatorFeatures.has("MaxTextureResolution"))
- {
- S32 max_texture_resolution = mSimulatorFeatures["MaxTextureResolution"].asInteger();
- gSavedSettings.setS32("max_texture_dimension_X", max_texture_resolution);
- gSavedSettings.setS32("max_texture_dimension_Y", max_texture_resolution);
- }
- else
- {
- gSavedSettings.setS32("max_texture_dimension_X", 1024);
- gSavedSettings.setS32("max_texture_dimension_Y", 1024);
- }
+ // WARNING: this is called from a coroutine, and flipping saved settings has a LOT of side effects, shuttle
+ // the work below back to the main loop
+ //
+
+ // copy features to lambda in case the region is deleted before the lambda is executed
+ LLSD features = mSimulatorFeatures;
+
+ auto work = [=]()
+ {
+ // if region has MaxTextureResolution, set max_texture_dimension settings, otherwise use default
+ if (features.has("MaxTextureResolution"))
+ {
+ S32 max_texture_resolution = features["MaxTextureResolution"].asInteger();
+ gSavedSettings.setS32("max_texture_dimension_X", max_texture_resolution);
+ gSavedSettings.setS32("max_texture_dimension_Y", max_texture_resolution);
+ }
+ else
+ {
+ gSavedSettings.setS32("max_texture_dimension_X", 1024);
+ gSavedSettings.setS32("max_texture_dimension_Y", 1024);
+ }
- bool mirrors_enabled = false;
- if (mSimulatorFeatures.has("MirrorsEnabled"))
- {
- mirrors_enabled = mSimulatorFeatures["MirrorsEnabled"].asBoolean();
- }
+ bool mirrors_enabled = false;
+ if (features.has("MirrorsEnabled"))
+ {
+ mirrors_enabled = features["MirrorsEnabled"].asBoolean();
+ }
- gSavedSettings.setBOOL("RenderMirrors", mirrors_enabled);
+ gSavedSettings.setBOOL("RenderMirrors", mirrors_enabled);
- if (mSimulatorFeatures.has("PBRTerrainEnabled"))
- {
- bool enabled = mSimulatorFeatures["PBRTerrainEnabled"];
- gSavedSettings.setBOOL("RenderTerrainPBREnabled", enabled);
- }
- else
- {
- gSavedSettings.setBOOL("RenderTerrainPBREnabled", false);
- }
+ if (features.has("PBRTerrainEnabled"))
+ {
+ bool enabled = features["PBRTerrainEnabled"];
+ gSavedSettings.setBOOL("RenderTerrainPBREnabled", enabled);
+ }
+ else
+ {
+ gSavedSettings.setBOOL("RenderTerrainPBREnabled", false);
+ }
- if (mSimulatorFeatures.has("PBRMaterialSwatchEnabled"))
- {
- bool enabled = mSimulatorFeatures["PBRMaterialSwatchEnabled"];
- gSavedSettings.setBOOL("UIPreviewMaterial", enabled);
- }
- else
+ if (features.has("PBRMaterialSwatchEnabled"))
+ {
+ bool enabled = features["PBRMaterialSwatchEnabled"];
+ gSavedSettings.setBOOL("UIPreviewMaterial", enabled);
+ }
+ else
+ {
+ gSavedSettings.setBOOL("UIPreviewMaterial", false);
+ }
+ };
+
+ auto workqueue = LL::WorkQueue::getInstance("mainloop");
+ if (workqueue)
{
- gSavedSettings.setBOOL("UIPreviewMaterial", false);
+ LL::WorkQueue::postMaybe(workqueue, work);
}
}