From f2a059e985ffd95b9b5141a82227b7b7d0078684 Mon Sep 17 00:00:00 2001 From: Inusaito Sayori Date: Sat, 21 Feb 2015 10:23:05 -0500 Subject: [PATCH] Rework HippoGridManager's parseUrl to be called after LLAppViewer::init No more hangs~ I'm not exactly sure if this exhibits the same behavior it used to, but this doesn't matter because it hasn't worked for versions, probably since AICurl, so no one is relying on it. It would seem to me that it needs to be called after pumps are created. parseUrl is now public. Also, move hippogridmanager.h into AI_UNUSED section of llxmlrpcresponder.cpp, it's part of the unused --- indra/newview/hippogridmanager.cpp | 10 ++++------ indra/newview/hippogridmanager.h | 3 ++- indra/newview/llappviewer.cpp | 5 +++++ indra/newview/llxmlrpcresponder.cpp | 2 +- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/indra/newview/hippogridmanager.cpp b/indra/newview/hippogridmanager.cpp index ddadd6742..c2223fbe5 100644 --- a/indra/newview/hippogridmanager.cpp +++ b/indra/newview/hippogridmanager.cpp @@ -786,9 +786,6 @@ void HippoGridManager::loadFromFile() parseFile(gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "grids_sg1.xml"), false); // merge default grid info, if newer. Force load, if list of grids is empty. parseFile(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "default_grids.xml"), !mGridInfo.empty()); - // merge grid info from web site, if newer. Force load, if list of grids is empty. - if (gSavedSettings.getBOOL("CheckForGridUpdates")) - parseUrl(gSavedSettings.getString("GridUpdateList"), !mGridInfo.empty()); std::string last_grid = gSavedSettings.getString("LastSelectedGrid"); if (last_grid.empty()) last_grid = gSavedSettings.getString("DefaultGrid"); @@ -796,8 +793,9 @@ void HippoGridManager::loadFromFile() setCurrentGrid(last_grid); } -void HippoGridManager::parseUrl(const std::string url, bool mergeIfNewer) +void HippoGridManager::parseUrl() { + const std::string& url(gSavedSettings.getString("GridUpdateList")); if (url.empty()) return; llinfos << "Loading grid info from '" << url << "'." << llendl; @@ -816,8 +814,8 @@ void HippoGridManager::parseUrl(const std::string url, bool mergeIfNewer) return; } - LLSD gridInfo = response["body"]; - parseData(gridInfo, mergeIfNewer); + // Force load, if list of grids is empty. + parseData(response["body"], !mGridInfo.empty()); } void HippoGridManager::parseFile(const std::string& fileName, bool mergeIfNewer) diff --git a/indra/newview/hippogridmanager.h b/indra/newview/hippogridmanager.h index a33970e28..5bc4b08ef 100644 --- a/indra/newview/hippogridmanager.h +++ b/indra/newview/hippogridmanager.h @@ -187,6 +187,8 @@ public: return mCurrentGridChangeSignal->connect(cb); } + void parseUrl(); + private: friend class HippoGridInfo; std::map mGridInfo; @@ -200,7 +202,6 @@ private: void cleanup(); void loadFromFile(); void parseFile(const std::string& fileName, bool mergeIfNewer); - void parseUrl(const std::string url, bool mergeIfNewer); void parseData(LLSD &gridInfo, bool mergeIfNewer); }; diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 3ed202986..933b87bee 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -1130,6 +1130,11 @@ bool LLAppViewer::mainLoop() joystick->setNeedsReset(true); LLEventPump& mainloop(LLEventPumps::instance().obtain("mainloop")); + + // merge grid info from web site, if newer. + if (gSavedSettings.getBOOL("CheckForGridUpdates")) + gHippoGridManager->parseUrl(); + // As we do not (yet) send data on the mainloop LLEventPump that varies // with each frame, no need to instantiate a new LLSD event object each // time. Obviously, if that changes, just instantiate the LLSD at the diff --git a/indra/newview/llxmlrpcresponder.cpp b/indra/newview/llxmlrpcresponder.cpp index 2dbfa9148..2dc56449a 100644 --- a/indra/newview/llxmlrpcresponder.cpp +++ b/indra/newview/llxmlrpcresponder.cpp @@ -45,7 +45,6 @@ #include "llappviewer.h" -#include "hippogridmanager.h" #include "aicurleasyrequeststatemachine.h" #ifdef CWDEBUG @@ -213,6 +212,7 @@ LLXMLRPCValue XMLRPCResponder::responseValue(void) const } #ifdef AI_UNUSED +#include "hippogridmanager.h" void LLXMLRPCTransaction::Impl::setStatus(Status status, const std::string& message, const std::string& uri) {