Skip to content
Snippets Groups Projects
Commit 0c84313a authored by andreykproductengine's avatar andreykproductengine
Browse files

SL-11321 Do not crash floater if capability is missing

parent c338d337
No related branches found
No related tags found
No related merge requests found
...@@ -41,6 +41,7 @@ const S32 SIZE_OF_ONE_KB = 1024; ...@@ -41,6 +41,7 @@ const S32 SIZE_OF_ONE_KB = 1024;
LLFloaterMyScripts::LLFloaterMyScripts(const LLSD& seed) LLFloaterMyScripts::LLFloaterMyScripts(const LLSD& seed)
: LLFloater(seed), : LLFloater(seed),
mGotAttachmentMemoryUsed(false), mGotAttachmentMemoryUsed(false),
mAttachmentDetailsRequested(false),
mAttachmentMemoryMax(0), mAttachmentMemoryMax(0),
mAttachmentMemoryUsed(0), mAttachmentMemoryUsed(0),
mGotAttachmentURLsUsed(false), mGotAttachmentURLsUsed(false),
...@@ -55,12 +56,24 @@ BOOL LLFloaterMyScripts::postBuild() ...@@ -55,12 +56,24 @@ BOOL LLFloaterMyScripts::postBuild()
std::string msg_waiting = LLTrans::getString("ScriptLimitsRequestWaiting"); std::string msg_waiting = LLTrans::getString("ScriptLimitsRequestWaiting");
getChild<LLUICtrl>("loading_text")->setValue(LLSD(msg_waiting)); getChild<LLUICtrl>("loading_text")->setValue(LLSD(msg_waiting));
return requestAttachmentDetails(); mAttachmentDetailsRequested = requestAttachmentDetails();
return TRUE;
} }
BOOL LLFloaterMyScripts::requestAttachmentDetails() // virtual
void LLFloaterMyScripts::onOpen(const LLSD& key)
{ {
if (!gAgent.getRegion()) return FALSE; if (!mAttachmentDetailsRequested)
{
mAttachmentDetailsRequested = requestAttachmentDetails();
}
LLFloater::onOpen(key);
}
bool LLFloaterMyScripts::requestAttachmentDetails()
{
if (!gAgent.getRegion()) return false;
LLSD body; LLSD body;
std::string url = gAgent.getRegion()->getCapability("AttachmentResources"); std::string url = gAgent.getRegion()->getCapability("AttachmentResources");
...@@ -68,11 +81,11 @@ BOOL LLFloaterMyScripts::requestAttachmentDetails() ...@@ -68,11 +81,11 @@ BOOL LLFloaterMyScripts::requestAttachmentDetails()
{ {
LLCoros::instance().launch("LLFloaterMyScripts::getAttachmentLimitsCoro", LLCoros::instance().launch("LLFloaterMyScripts::getAttachmentLimitsCoro",
boost::bind(&LLFloaterMyScripts::getAttachmentLimitsCoro, this, url)); boost::bind(&LLFloaterMyScripts::getAttachmentLimitsCoro, this, url));
return TRUE; return true;
} }
else else
{ {
return FALSE; return false;
} }
} }
...@@ -284,7 +297,7 @@ void LLFloaterMyScripts::onClickRefresh(void* userdata) ...@@ -284,7 +297,7 @@ void LLFloaterMyScripts::onClickRefresh(void* userdata)
btn->setEnabled(false); btn->setEnabled(false);
} }
instance->clearList(); instance->clearList();
instance->requestAttachmentDetails(); instance->mAttachmentDetailsRequested = instance->requestAttachmentDetails();
} }
else else
{ {
......
...@@ -36,15 +36,17 @@ class LLFloaterMyScripts : public LLFloater ...@@ -36,15 +36,17 @@ class LLFloaterMyScripts : public LLFloater
LLFloaterMyScripts(const LLSD& seed); LLFloaterMyScripts(const LLSD& seed);
BOOL postBuild(); BOOL postBuild();
/*virtual*/ void onOpen(const LLSD& key);
void setAttachmentDetails(LLSD content); void setAttachmentDetails(LLSD content);
void setAttachmentSummary(LLSD content); void setAttachmentSummary(LLSD content);
BOOL requestAttachmentDetails(); bool requestAttachmentDetails();
void clearList(); void clearList();
private: private:
void getAttachmentLimitsCoro(std::string url); void getAttachmentLimitsCoro(std::string url);
bool mGotAttachmentMemoryUsed; bool mGotAttachmentMemoryUsed;
bool mAttachmentDetailsRequested;
S32 mAttachmentMemoryMax; S32 mAttachmentMemoryMax;
S32 mAttachmentMemoryUsed; S32 mAttachmentMemoryUsed;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment