diff options
Diffstat (limited to 'indra')
-rwxr-xr-x | indra/newview/llfloatertos.cpp | 18 | ||||
-rwxr-xr-x | indra/newview/llfloatertos.h | 2 |
2 files changed, 14 insertions, 6 deletions
diff --git a/indra/newview/llfloatertos.cpp b/indra/newview/llfloatertos.cpp index 3597d70e0d..5fa4441914 100755 --- a/indra/newview/llfloatertos.cpp +++ b/indra/newview/llfloatertos.cpp @@ -196,8 +196,10 @@ void LLFloaterTOS::handleMediaEvent(LLPluginClassMedia* /*self*/, EMediaEvent ev mLoadingScreenLoaded = true; std::string url(getString("real_url")); + LLHandle<LLFloater> handle = getHandle(); + LLCoros::instance().launch("LLFloaterTOS::testSiteIsAliveCoro", - boost::bind(&LLFloaterTOS::testSiteIsAliveCoro, url)); + boost::bind(&LLFloaterTOS::testSiteIsAliveCoro, handle, url)); } else if(mRealNavigateBegun) { @@ -209,7 +211,7 @@ void LLFloaterTOS::handleMediaEvent(LLPluginClassMedia* /*self*/, EMediaEvent ev } } -void LLFloaterTOS::testSiteIsAliveCoro(std::string url) +void LLFloaterTOS::testSiteIsAliveCoro(LLHandle<LLFloater> handle, std::string url) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t @@ -228,13 +230,19 @@ void LLFloaterTOS::testSiteIsAliveCoro(std::string url) LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); - LLFloaterTOS *that = LLFloaterReg::findTypedInstance<LLFloaterTOS>("message_tos"); - // double not. + if (handle.isDead()) + { + LL_WARNS("testSiteIsAliveCoro") << "Dialog canceled before response." << LL_ENDL; + return; + } + + LLFloaterTOS *that = dynamic_cast<LLFloaterTOS *>(handle.get()); + if (that) that->setSiteIsAlive(static_cast<bool>(status)); else { - LL_WARNS("testSiteIsAliveCoro") << "Dialog canceled before response." << LL_ENDL; + LL_WARNS("testSiteIsAliveCoro") << "Handle was not a TOS floater." << LL_ENDL; } } diff --git a/indra/newview/llfloatertos.h b/indra/newview/llfloatertos.h index b71b80ed24..e70c9f24af 100755 --- a/indra/newview/llfloatertos.h +++ b/indra/newview/llfloatertos.h @@ -62,7 +62,7 @@ public: /*virtual*/ void handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event); private: - static void testSiteIsAliveCoro(std::string url); + static void testSiteIsAliveCoro(LLHandle<LLFloater> handle, std::string url); std::string mMessage; bool mLoadingScreenLoaded; |