summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2015-08-18 17:05:29 -0400
committerNat Goodspeed <nat@lindenlab.com>2015-08-18 17:05:29 -0400
commit62527e6f18f0a035a234cf584e31f7eea93fd4a7 (patch)
tree29f532cde7b0cf0fbf96cd4def3c89c77717b8fb
parent02b7e7ce07948a25bc1f58fdbfe3499dc917340f (diff)
MAINT-5506: Fix ugly timing bug in llurlentry static initialization.
The problem was that class-static LLUrlEntryParcel::sRegionHost was being initialized by copying class-static LLHost::invalid. Naturally, these two statics are initialized in different source files. Since C++ makes no promises about the relative order in which objects in different object files are initialized, it seems we hit a case in which we were trying to initialize sRegionHost by copying a completely uninitialized LLHost::invalid. In general we might attempt to address such cross-translation-unit issues by introducing an LLSingleton. But in this particular case, the punch line is that LLHost::invalid is explicitly constructed identically to a default-constructed LLHost! In other words, LLHost::invalid provides nothing we couldn't get from LLHost(). All it gives us is an opportunity for glitches such as the above. Remove LLHost::invalid and all references, replacing with LLHost().
-rwxr-xr-xindra/llmessage/llassetstorage.cpp2
-rwxr-xr-xindra/llmessage/llcachename.cpp2
-rwxr-xr-xindra/llmessage/llhost.cpp2
-rwxr-xr-xindra/llmessage/llhost.h2
-rwxr-xr-xindra/llmessage/message.cpp2
-rwxr-xr-xindra/llui/llurlentry.cpp4
-rwxr-xr-xindra/llui/tests/llurlentry_stub.cpp2
-rwxr-xr-xindra/newview/llagent.cpp2
-rwxr-xr-xindra/newview/llfloatergodtools.cpp6
-rwxr-xr-xindra/newview/llpreviewnotecard.cpp2
-rwxr-xr-xindra/newview/llpreviewscript.cpp2
-rwxr-xr-xindra/newview/lltexturefetch.cpp8
-rwxr-xr-xindra/newview/llviewerobject.cpp6
-rwxr-xr-xindra/newview/llviewertexture.h6
-rwxr-xr-xindra/newview/llviewertexturelist.cpp2
-rwxr-xr-xindra/newview/llvoavatar.cpp2
16 files changed, 23 insertions, 29 deletions
diff --git a/indra/llmessage/llassetstorage.cpp b/indra/llmessage/llassetstorage.cpp
index 8ba2535531..a6edafecf8 100755
--- a/indra/llmessage/llassetstorage.cpp
+++ b/indra/llmessage/llassetstorage.cpp
@@ -290,7 +290,7 @@ LLAssetStorage::LLAssetStorage(LLMessageSystem *msg, LLXferManager *xfer, LLVFS
LLAssetStorage::LLAssetStorage(LLMessageSystem *msg, LLXferManager *xfer,
LLVFS *vfs, LLVFS *static_vfs)
{
- _init(msg, xfer, vfs, static_vfs, LLHost::invalid);
+ _init(msg, xfer, vfs, static_vfs, LLHost());
}
diff --git a/indra/llmessage/llcachename.cpp b/indra/llmessage/llcachename.cpp
index daf3e0b4de..66bd85f4e6 100755
--- a/indra/llmessage/llcachename.cpp
+++ b/indra/llmessage/llcachename.cpp
@@ -259,7 +259,7 @@ LLCacheName::~LLCacheName()
}
LLCacheName::Impl::Impl(LLMessageSystem* msg)
- : mMsg(msg), mUpstreamHost(LLHost::invalid)
+ : mMsg(msg), mUpstreamHost(LLHost())
{
mMsg->setHandlerFuncFast(
_PREHASH_UUIDNameRequest, handleUUIDNameRequest, (void**)this);
diff --git a/indra/llmessage/llhost.cpp b/indra/llmessage/llhost.cpp
index 63c15f0d5e..ae5c2ecf69 100755
--- a/indra/llmessage/llhost.cpp
+++ b/indra/llmessage/llhost.cpp
@@ -41,8 +41,6 @@
#include <arpa/inet.h>
#endif
-LLHost LLHost::invalid(INVALID_PORT,INVALID_HOST_IP_ADDRESS);
-
LLHost::LLHost(const std::string& ip_and_port)
{
std::string::size_type colon_index = ip_and_port.find(":");
diff --git a/indra/llmessage/llhost.h b/indra/llmessage/llhost.h
index 9a221e2a6e..376371cffd 100755
--- a/indra/llmessage/llhost.h
+++ b/indra/llmessage/llhost.h
@@ -42,8 +42,6 @@ protected:
U32 mIP;
std::string mUntrustedSimCap;
public:
-
- static LLHost invalid;
// CREATORS
LLHost()
diff --git a/indra/llmessage/message.cpp b/indra/llmessage/message.cpp
index feb756a0c7..6712171418 100755
--- a/indra/llmessage/message.cpp
+++ b/indra/llmessage/message.cpp
@@ -1675,7 +1675,7 @@ LLHost LLMessageSystem::findHost(const U32 circuit_code)
}
else
{
- return LLHost::invalid;
+ return LLHost();
}
}
diff --git a/indra/llui/llurlentry.cpp b/indra/llui/llurlentry.cpp
index 6db0d88998..adefae6e2d 100755
--- a/indra/llui/llurlentry.cpp
+++ b/indra/llui/llurlentry.cpp
@@ -957,7 +957,7 @@ std::string LLUrlEntryObjectIM::getLocation(const std::string &url) const
// LLUrlEntryParcel statics.
LLUUID LLUrlEntryParcel::sAgentID(LLUUID::null);
LLUUID LLUrlEntryParcel::sSessionID(LLUUID::null);
-LLHost LLUrlEntryParcel::sRegionHost(LLHost::invalid);
+LLHost LLUrlEntryParcel::sRegionHost;
bool LLUrlEntryParcel::sDisconnected(false);
std::set<LLUrlEntryParcel*> LLUrlEntryParcel::sParcelInfoObservers;
@@ -1006,7 +1006,7 @@ std::string LLUrlEntryParcel::getLabel(const std::string &url, const LLUrlLabelC
void LLUrlEntryParcel::sendParcelInfoRequest(const LLUUID& parcel_id)
{
- if (sRegionHost == LLHost::invalid || sDisconnected) return;
+ if (sRegionHost == LLHost() || sDisconnected) return;
LLMessageSystem *msg = gMessageSystem;
msg->newMessage("ParcelInfoRequest");
diff --git a/indra/llui/tests/llurlentry_stub.cpp b/indra/llui/tests/llurlentry_stub.cpp
index 5d3f9ac327..f01178c374 100755
--- a/indra/llui/tests/llurlentry_stub.cpp
+++ b/indra/llui/tests/llurlentry_stub.cpp
@@ -165,8 +165,6 @@ LLFontGL* LLFontGL::getFontDefault()
char const* const _PREHASH_AgentData = (char *)"AgentData";
char const* const _PREHASH_AgentID = (char *)"AgentID";
-LLHost LLHost::invalid(INVALID_PORT,INVALID_HOST_IP_ADDRESS);
-
LLMessageSystem* gMessageSystem = NULL;
//
diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp
index 7147769c43..e7dd378edd 100755
--- a/indra/newview/llagent.cpp
+++ b/indra/newview/llagent.cpp
@@ -930,7 +930,7 @@ LLHost LLAgent::getRegionHost() const
}
else
{
- return LLHost::invalid;
+ return LLHost();
}
}
diff --git a/indra/newview/llfloatergodtools.cpp b/indra/newview/llfloatergodtools.cpp
index 37774fbc5c..adc7f71586 100755
--- a/indra/newview/llfloatergodtools.cpp
+++ b/indra/newview/llfloatergodtools.cpp
@@ -115,7 +115,7 @@ void LLFloaterGodTools::refreshAll()
LLFloaterGodTools::LLFloaterGodTools(const LLSD& key)
: LLFloater(key),
- mCurrentHost(LLHost::invalid),
+ mCurrentHost(LLHost()),
mUpdateTimer()
{
mFactoryMap["grid"] = LLCallbackMap(createPanelGrid, this);
@@ -180,7 +180,7 @@ void LLFloaterGodTools::updatePopup(LLCoordGL center, MASK mask)
// virtual
void LLFloaterGodTools::draw()
{
- if (mCurrentHost == LLHost::invalid)
+ if (mCurrentHost == LLHost())
{
if (mUpdateTimer.getElapsedTimeF32() > SECONDS_BETWEEN_UPDATE_REQUESTS)
{
@@ -325,7 +325,7 @@ void LLFloaterGodTools::sendRegionInfoRequest()
{
if (mPanelRegionTools) mPanelRegionTools->clearAllWidgets();
if (mPanelObjectTools) mPanelObjectTools->clearAllWidgets();
- mCurrentHost = LLHost::invalid;
+ mCurrentHost = LLHost();
mUpdateTimer.reset();
LLMessageSystem* msg = gMessageSystem;
diff --git a/indra/newview/llpreviewnotecard.cpp b/indra/newview/llpreviewnotecard.cpp
index 2c609d902c..308b6ee922 100755
--- a/indra/newview/llpreviewnotecard.cpp
+++ b/indra/newview/llpreviewnotecard.cpp
@@ -232,7 +232,7 @@ void LLPreviewNotecard::loadAsset()
}
else
{
- LLHost source_sim = LLHost::invalid;
+ LLHost source_sim = LLHost();
if (mObjectUUID.notNull())
{
LLViewerObject *objectp = gObjectList.findObject(mObjectUUID);
diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp
index 11a503e71f..b6210bdc6b 100755
--- a/indra/newview/llpreviewscript.cpp
+++ b/indra/newview/llpreviewscript.cpp
@@ -1571,7 +1571,7 @@ void LLPreviewLSL::loadAsset()
if (gAgent.isGodlike() || (is_copyable && (is_modifiable || is_library)))
{
LLUUID* new_uuid = new LLUUID(mItemUUID);
- gAssetStorage->getInvItemAsset(LLHost::invalid,
+ gAssetStorage->getInvItemAsset(LLHost(),
gAgent.getID(),
gAgent.getSessionID(),
item->getPermissions().getOwner(),
diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp
index e61eeb2f4e..6674532efa 100755
--- a/indra/newview/lltexturefetch.cpp
+++ b/indra/newview/lltexturefetch.cpp
@@ -1328,11 +1328,11 @@ bool LLTextureFetchWorker::doWork(S32 param)
static LLCachedControl<bool> use_http(gSavedSettings, "ImagePipelineUseHTTP", true);
-// if (mHost != LLHost::invalid) get_url = false;
+// if (mHost != LLHost()) get_url = false;
if ( use_http && mCanUseHTTP && mUrl.empty())//get http url.
{
LLViewerRegion* region = NULL;
- if (mHost == LLHost::invalid)
+ if (mHost == LLHost())
region = gAgent.getRegion();
else
region = LLWorld::getInstance()->getRegion(mHost);
@@ -3224,7 +3224,7 @@ void LLTextureFetch::sendRequestListToSimulators()
{
LLHost host = iter1->first;
// invalid host = use agent host
- if (host == LLHost::invalid)
+ if (host == LLHost())
{
host = gAgent.getRegionHost();
}
@@ -3304,7 +3304,7 @@ void LLTextureFetch::sendRequestListToSimulators()
iter1 != mCancelQueue.end(); ++iter1)
{
LLHost host = iter1->first;
- if (host == LLHost::invalid)
+ if (host == LLHost())
{
host = gAgent.getRegionHost();
}
diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp
index ac3f07fcd8..190102ff0f 100755
--- a/indra/newview/llviewerobject.cpp
+++ b/indra/newview/llviewerobject.cpp
@@ -4437,21 +4437,21 @@ S32 LLViewerObject::setTETexture(const U8 te, const LLUUID& uuid)
{
// Invalid host == get from the agent's sim
LLViewerFetchedTexture *image = LLViewerTextureManager::getFetchedTexture(
- uuid, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, LLHost::invalid);
+ uuid, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, LLHost());
return setTETextureCore(te,image);
}
S32 LLViewerObject::setTENormalMap(const U8 te, const LLUUID& uuid)
{
LLViewerFetchedTexture *image = (uuid == LLUUID::null) ? NULL : LLViewerTextureManager::getFetchedTexture(
- uuid, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, LLHost::invalid);
+ uuid, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, LLHost());
return setTENormalMapCore(te, image);
}
S32 LLViewerObject::setTESpecularMap(const U8 te, const LLUUID& uuid)
{
LLViewerFetchedTexture *image = (uuid == LLUUID::null) ? NULL : LLViewerTextureManager::getFetchedTexture(
- uuid, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, LLHost::invalid);
+ uuid, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, LLHost());
return setTESpecularMapCore(te, image);
}
diff --git a/indra/newview/llviewertexture.h b/indra/newview/llviewertexture.h
index aed7e94945..e496cb9f78 100755
--- a/indra/newview/llviewertexture.h
+++ b/indra/newview/llviewertexture.h
@@ -266,7 +266,7 @@ class LLViewerFetchedTexture : public LLViewerTexture
protected:
/*virtual*/ ~LLViewerFetchedTexture();
public:
- LLViewerFetchedTexture(const LLUUID& id, FTType f_type, const LLHost& host = LLHost::invalid, BOOL usemipmaps = TRUE);
+ LLViewerFetchedTexture(const LLUUID& id, FTType f_type, const LLHost& host = LLHost(), BOOL usemipmaps = TRUE);
LLViewerFetchedTexture(const LLImageRaw* raw, FTType f_type, BOOL usemipmaps);
LLViewerFetchedTexture(const std::string& url, FTType f_type, const LLUUID& id, BOOL usemipmaps = TRUE);
@@ -498,7 +498,7 @@ protected:
S32 mCachedRawDiscardLevel;
BOOL mCachedRawImageReady; //the rez of the mCachedRawImage reaches the upper limit.
- LLHost mTargetHost; // if LLHost::invalid, just request from agent's simulator
+ LLHost mTargetHost; // if invalid, just request from agent's simulator
// Timers
LLFrameTimer mLastPacketTimer; // Time since last packet.
@@ -528,7 +528,7 @@ protected:
/*virtual*/ ~LLViewerLODTexture(){}
public:
- LLViewerLODTexture(const LLUUID& id, FTType f_type, const LLHost& host = LLHost::invalid, BOOL usemipmaps = TRUE);
+ LLViewerLODTexture(const LLUUID& id, FTType f_type, const LLHost& host = LLHost(), BOOL usemipmaps = TRUE);
LLViewerLODTexture(const std::string& url, FTType f_type, const LLUUID& id, BOOL usemipmaps = TRUE);
/*virtual*/ S8 getType() const;
diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp
index 926c40307b..0232dcfa15 100755
--- a/indra/newview/llviewertexturelist.cpp
+++ b/indra/newview/llviewertexturelist.cpp
@@ -236,7 +236,7 @@ void LLViewerTextureList::shutdown()
if (!image->hasGLTexture() ||
!image->getUseDiscard() ||
image->needsAux() ||
- image->getTargetHost() != LLHost::invalid ||
+ image->getTargetHost() != LLHost() ||
!image->getUrl().empty()
)
{
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index f753448770..db949437a7 100755
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -8095,7 +8095,7 @@ LLHost LLVOAvatar::getObjectHost() const
}
else
{
- return LLHost::invalid;
+ return LLHost();
}
}