From 36b8b88153180f637c24709dc94739b5f4c4367e Mon Sep 17 00:00:00 2001 From: "Andrew A. de Laix" Date: Mon, 1 Nov 2010 09:33:30 -0700 Subject: changes in respone to review comments. --- indra/viewer_components/updater/llupdatechecker.cpp | 7 ++++++- indra/viewer_components/updater/llupdaterservice.cpp | 10 +++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/indra/viewer_components/updater/llupdatechecker.cpp b/indra/viewer_components/updater/llupdatechecker.cpp index 941210d35b..8733bb7ac0 100644 --- a/indra/viewer_components/updater/llupdatechecker.cpp +++ b/indra/viewer_components/updater/llupdatechecker.cpp @@ -52,7 +52,7 @@ private: Client & mClient; LLHTTPClient mHttpClient; bool mInProgress; - LLHTTPClient::ResponderPtr mMe; + LLHTTPClient::ResponderPtr mMe; std::string mVersion; LOG_CLASS(LLUpdateChecker::Implementation); @@ -105,6 +105,11 @@ void LLUpdateChecker::Implementation::check(std::string const & host, std::strin mVersion = version; std::string checkUrl = buildUrl(host, channel, version); LL_INFOS("UpdateCheck") << "checking for updates at " << checkUrl << llendl; + + // The HTTP client will wrap a raw pointer in a boost::intrusive_ptr causing the + // passed object to be silently and automatically deleted. We pass a self- + // referential intrusive pointer stored as an attribute of this class to keep + // the client from deletig the update checker implementation instance. mHttpClient.get(checkUrl, mMe); } diff --git a/indra/viewer_components/updater/llupdaterservice.cpp b/indra/viewer_components/updater/llupdaterservice.cpp index 2633dbc015..62c909e57b 100644 --- a/indra/viewer_components/updater/llupdaterservice.cpp +++ b/indra/viewer_components/updater/llupdaterservice.cpp @@ -40,7 +40,7 @@ class LLUpdaterServiceImpl : public LLPluginProcessParentOwner, public LLUpdateChecker::Client { - static const std::string ListenerName; + static const std::string sListenerName; std::string mUrl; std::string mChannel; @@ -86,7 +86,7 @@ public: bool onMainLoop(LLSD const & event); }; -const std::string LLUpdaterServiceImpl::ListenerName = "LLUpdaterServiceImpl"; +const std::string LLUpdaterServiceImpl::sListenerName = "LLUpdaterServiceImpl"; LLUpdaterServiceImpl::LLUpdaterServiceImpl() : mIsChecking(false), @@ -101,7 +101,7 @@ LLUpdaterServiceImpl::LLUpdaterServiceImpl() : LLUpdaterServiceImpl::~LLUpdaterServiceImpl() { LL_INFOS("UpdaterService") << "shutting down updater service" << LL_ENDL; - LLEventPumps::instance().obtain("mainloop").stopListening(ListenerName); + LLEventPumps::instance().obtain("mainloop").stopListening(sListenerName); } // LLPluginProcessParentOwner interfaces @@ -197,7 +197,7 @@ void LLUpdaterServiceImpl::retry(void) mTimer.start(); mTimer.setTimerExpirySec(mCheckPeriod); LLEventPumps::instance().obtain("mainloop").listen( - ListenerName, boost::bind(&LLUpdaterServiceImpl::onMainLoop, this, _1)); + sListenerName, boost::bind(&LLUpdaterServiceImpl::onMainLoop, this, _1)); } bool LLUpdaterServiceImpl::onMainLoop(LLSD const & event) @@ -205,7 +205,7 @@ bool LLUpdaterServiceImpl::onMainLoop(LLSD const & event) if(mTimer.hasExpired()) { mTimer.stop(); - LLEventPumps::instance().obtain("mainloop").stopListening(ListenerName); + LLEventPumps::instance().obtain("mainloop").stopListening(sListenerName); mUpdateChecker.check(mUrl, mChannel, mVersion); } else { // Keep on waiting... -- cgit v1.2.3