From cad41f1ae08927737eca4cd9df25381d78e82304 Mon Sep 17 00:00:00 2001
From: McCabe Maxsted
Date: Sun, 13 Jun 2010 13:01:57 -0700
Subject: Fixed #338: addRegion/removeRegion can trigger a viewer quit
---
linden/indra/newview/llstartup.cpp | 13 ++++++++++---
linden/indra/newview/llviewermessage.cpp | 20 ++++++++++++--------
linden/indra/newview/llworld.cpp | 18 ++++++++++++------
.../skins/default/xui/en-us/notifications.xml | 7 +++++++
4 files changed, 41 insertions(+), 17 deletions(-)
(limited to 'linden/indra')
diff --git a/linden/indra/newview/llstartup.cpp b/linden/indra/newview/llstartup.cpp
index 8882773..30e299a 100644
--- a/linden/indra/newview/llstartup.cpp
+++ b/linden/indra/newview/llstartup.cpp
@@ -1791,8 +1791,13 @@ bool idle_startup()
regionp->setSeedCapability(first_sim_seed_cap);
LL_DEBUGS("AppInit") << "Waiting for seed grant ...." << LL_ENDL;
- // Set agent's initial region to be the one we just created.
- gAgent.setRegion(regionp);
+ // Set agent's initial region to be the one we just created
+ // Only if we don't already have one set. We want to catch this here
+ // because setRegion calls removeRegion, which kills the viewer -- MC
+ if (!gAgent.getRegion() && gAgent.getRegion() != regionp)
+ {
+ gAgent.setRegion(regionp);
+ }
// Set agent's initial position, which will be read by LLVOAvatar when the avatar
// object is created. I think this must be done after setting the region. JC
@@ -2095,7 +2100,7 @@ bool idle_startup()
if (STATE_AGENT_WAIT == LLStartUp::getStartupState())
{
LL_DEBUGS("AppInitStartupState") << "STATE_AGENT_WAIT" << LL_ENDL;
- if (connecting_region_timer.getElapsedTimeF32() > 15.0f)
+ if (connecting_region_timer.getElapsedTimeF32() > 10.0f)
{
// Bounce back to the login screen -- MC
LL_WARNS("AppInit") << "Bad login - can't connect to this region for some reason" << LL_ENDL;
@@ -3596,6 +3601,7 @@ std::string LLStartUp::startupStateToString(EStartupState state)
#define RTNENUM(E) case E: return #E
switch(state){
RTNENUM( STATE_FIRST );
+ RTNENUM( STATE_BROWSER_INIT );
RTNENUM( STATE_LOGIN_SHOW );
RTNENUM( STATE_LOGIN_WAIT );
RTNENUM( STATE_LOGIN_CLEANUP );
@@ -3606,6 +3612,7 @@ std::string LLStartUp::startupStateToString(EStartupState state)
RTNENUM( STATE_LOGIN_DOWNLOADING );
RTNENUM( STATE_LOGIN_PROCESS_RESPONSE );
RTNENUM( STATE_WORLD_INIT );
+ RTNENUM( STATE_MULTIMEDIA_INIT );
RTNENUM( STATE_SEED_GRANTED_WAIT );
RTNENUM( STATE_SEED_CAP_GRANTED );
RTNENUM( STATE_WORLD_WAIT );
diff --git a/linden/indra/newview/llviewermessage.cpp b/linden/indra/newview/llviewermessage.cpp
index 7832b99..58b6df4 100644
--- a/linden/indra/newview/llviewermessage.cpp
+++ b/linden/indra/newview/llviewermessage.cpp
@@ -3333,14 +3333,18 @@ void process_agent_movement_complete(LLMessageSystem* msg, void**)
// set our upstream host the new simulator and shuffle things as
// appropriate.
- LLVector3 shift_vector = regionp->getPosRegionFromGlobal(
- gAgent.getRegion()->getOriginGlobal());
- gAgent.setRegion(regionp);
- gObjectList.shiftObjects(shift_vector);
- gAssetStorage->setUpstream(msg->getSender());
- gCacheName->setUpstream(msg->getSender());
- gViewerThrottle.sendToSim();
- gViewerWindow->sendShapeToSim();
+ // Sometimes OpenSim will get here but still fail on a teleport -- MC
+ if (regionp != gAgent.getRegion())
+ {
+ LLVector3 shift_vector = regionp->getPosRegionFromGlobal(
+ gAgent.getRegion()->getOriginGlobal());
+ gAgent.setRegion(regionp);
+ gObjectList.shiftObjects(shift_vector);
+ gAssetStorage->setUpstream(msg->getSender());
+ gCacheName->setUpstream(msg->getSender());
+ gViewerThrottle.sendToSim();
+ gViewerWindow->sendShapeToSim();
+ }
bool is_teleport = gAgent.getTeleportState() == LLAgent::TELEPORT_MOVING;
diff --git a/linden/indra/newview/llworld.cpp b/linden/indra/newview/llworld.cpp
index 7cceb30..50d4250 100644
--- a/linden/indra/newview/llworld.cpp
+++ b/linden/indra/newview/llworld.cpp
@@ -267,11 +267,17 @@ void LLWorld::removeRegion(const LLHost &host)
llwarns << "Disabling region " << regionp->getName() << " that agent is in!" << llendl;
- // Don't ever forceQuit on the user if we can avoid it -- MC
+ // Don't ever forceQuit on the user during startup if we can avoid it -- MC
//LLAppViewer::instance()->forceDisconnect("You have been disconnected from the region you were in.");
- LLSD args;
- args["ERROR_MESSAGE"] = "You have been disconnected from the region you were in.";
- LLNotifications::instance().add("ErrorMessage", args, LLSD(), connecting_alert_done);
+ // We stop a login, even if it's a successful one, as the expected behavior is to not receive
+ // any more messages from a sim when we receive the DisableSimulator message, despite the viewer
+ // continuing to connect anyway -- MC
+ if (LLStartUp::getStartupState() < STATE_STARTED)
+ {
+ //LLStartUp::setLoginFailed(true);
+ LLStartUp::setStartupState(STATE_SEED_GRANTED_WAIT);
+ }
+ LLNotifications::instance().add("DisconnectedFromRegion", LLSD(), LLSD(), connecting_alert_done);
return;
}
@@ -1256,13 +1262,13 @@ bool connecting_alert_done(const LLSD& notification, const LLSD& response)
{
if (LLStartUp::getStartupState() < STATE_STARTED)
{
- //LLStartUp::setLoginFailed(true);
LLStartUp::resetLogin();
LLPanelLogin::giveFocus();
}
else
{
- LLAppViewer::instance()->requestLogout(false);
+ // TODO: make this translatable
+ LLAppViewer::instance()->forceDisconnect("You have been disconnected from the region you were in. Unable to continue.");
}
return false;
}
diff --git a/linden/indra/newview/skins/default/xui/en-us/notifications.xml b/linden/indra/newview/skins/default/xui/en-us/notifications.xml
index e0a0f60..f7f8e7e 100644
--- a/linden/indra/newview/skins/default/xui/en-us/notifications.xml
+++ b/linden/indra/newview/skins/default/xui/en-us/notifications.xml
@@ -6848,6 +6848,13 @@ Are you sure you want to teleport home?
+You have been disconnected from the region you were in. Unable to continue.
+
+
+
--
cgit v1.1