summaryrefslogtreecommitdiff
path: root/indra/newview/llenvironment.cpp
diff options
context:
space:
mode:
authorDave Parks <davep@lindenlab.com>2022-12-05 11:49:07 -0600
committerDave Parks <davep@lindenlab.com>2022-12-05 11:49:07 -0600
commit3ec5110129ffd29d8e76eb82e31da7470e281503 (patch)
tree72fd7f20285683f2031c7d82a31a88b2832d90ad /indra/newview/llenvironment.cpp
parent3c20f0b1d4dd7257dc608823d82b6f798c492b43 (diff)
parent7ceb266604de07ca6743dcd1077b675dea39f1d9 (diff)
Merge branch 'DRTVWR-559' of github.com:secondlife/viewer into DRTVWR-559
Diffstat (limited to 'indra/newview/llenvironment.cpp')
-rw-r--r--indra/newview/llenvironment.cpp25
1 files changed, 18 insertions, 7 deletions
diff --git a/indra/newview/llenvironment.cpp b/indra/newview/llenvironment.cpp
index 64d89282e2..efe4ad2af2 100644
--- a/indra/newview/llenvironment.cpp
+++ b/indra/newview/llenvironment.cpp
@@ -874,26 +874,37 @@ void LLEnvironment::initSingleton()
requestRegion();
- gAgent.addParcelChangedCallback([this]() { onParcelChange(); });
+ if (!mParcelCallbackConnection.connected())
+ {
+ mParcelCallbackConnection = gAgent.addParcelChangedCallback([this]() { onParcelChange(); });
- //TODO: This frequently results in one more request than we need. It isn't breaking, but should be nicer.
- // We need to know new env version to fix this, without it we can only do full re-request
- // Happens: on updates, on opening LLFloaterRegionInfo, on region crossing if info floater is open
- LLRegionInfoModel::instance().setUpdateCallback([this]() { requestRegion(); });
- gAgent.addRegionChangedCallback([this]() { onRegionChange(); });
+ //TODO: This frequently results in one more request than we need. It isn't breaking, but should be nicer.
+ // We need to know new env version to fix this, without it we can only do full re-request
+ // Happens: on updates, on opening LLFloaterRegionInfo, on region crossing if info floater is open
+ mRegionUpdateCallbackConnection = LLRegionInfoModel::instance().setUpdateCallback([this]() { requestRegion(); });
+ mRegionChangeCallbackConnection = gAgent.addRegionChangedCallback([this]() { onRegionChange(); });
- gAgent.whenPositionChanged([this](const LLVector3 &localpos, const LLVector3d &) { onAgentPositionHasChanged(localpos); });
+ mPositionCallbackConnection = gAgent.whenPositionChanged([this](const LLVector3 &localpos, const LLVector3d &) { onAgentPositionHasChanged(localpos); });
+ }
if (!gGenericDispatcher.isHandlerPresent(MESSAGE_PUSHENVIRONMENT))
{
gGenericDispatcher.addHandler(MESSAGE_PUSHENVIRONMENT, &environment_push_dispatch_handler);
}
+ LLEventPumps::instance().obtain(PUMP_EXPERIENCE).stopListening(LISTENER_NAME);
LLEventPumps::instance().obtain(PUMP_EXPERIENCE).listen(LISTENER_NAME, [this](LLSD message) { listenExperiencePump(message); return false; });
}
void LLEnvironment::cleanupSingleton()
{
+ if (mParcelCallbackConnection.connected())
+ {
+ mParcelCallbackConnection.disconnect();
+ mRegionUpdateCallbackConnection.disconnect();
+ mRegionChangeCallbackConnection.disconnect();
+ mPositionCallbackConnection.disconnect();
+ }
LLEventPumps::instance().obtain(PUMP_EXPERIENCE).stopListening(LISTENER_NAME);
}