summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorDave Parks <davep@lindenlab.com>2011-07-12 13:22:01 -0500
committerDave Parks <davep@lindenlab.com>2011-07-12 13:22:01 -0500
commit922bc0aa6ac35175618c54d1e5649678f6b62417 (patch)
tree7c951d7d80ff2cf38d3b9edeb2e3f097ee1e025b /indra
parentec0ee4f7c80bf5d32f50d2788545d629068f1cb1 (diff)
SH-2053 Don't poke the UI from a background thread -- it tends to get crashy.
Diffstat (limited to 'indra')
-rwxr-xr-xindra/newview/llfloatermodelpreview.cpp12
-rw-r--r--indra/newview/llfloatermodelpreview.h4
-rwxr-xr-xindra/newview/llmeshrepository.cpp11
3 files changed, 18 insertions, 9 deletions
diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp
index 0939e7bbbf..abec392316 100755
--- a/indra/newview/llfloatermodelpreview.cpp
+++ b/indra/newview/llfloatermodelpreview.cpp
@@ -5482,7 +5482,17 @@ void LLFloaterModelPreview::toggleCalculateButton(bool visible)
void LLFloaterModelPreview::onModelPhysicsFeeReceived(const LLSD& result, std::string upload_url)
{
- mUploadModelUrl = upload_url;
+ mModelPhysicsFee = result;
+ mModelPhysicsFee["url"] = upload_url;
+
+ doOnIdleOneTime(boost::bind(&LLFloaterModelPreview::handleModelPhysicsFeeReceived,this));
+}
+
+void LLFloaterModelPreview::handleModelPhysicsFeeReceived()
+{
+ const LLSD& result = mModelPhysicsFee;
+ mUploadModelUrl = result["url"].asString();
+
childSetTextArg("weights", "[EQ]", llformat("%0.3f", result["resource_cost"].asReal()));
childSetTextArg("weights", "[ST]", llformat("%0.3f", result["model_streaming_cost"].asReal()));
childSetTextArg("weights", "[SIM]", llformat("%0.3f", result["simulation_cost"].asReal()));
diff --git a/indra/newview/llfloatermodelpreview.h b/indra/newview/llfloatermodelpreview.h
index 29a61d6ed3..3a5f7602fe 100644
--- a/indra/newview/llfloatermodelpreview.h
+++ b/indra/newview/llfloatermodelpreview.h
@@ -201,7 +201,7 @@ public:
/*virtual*/ void setPermissonsErrorStatus(U32 status, const std::string& reason);
/*virtual*/ void onModelPhysicsFeeReceived(const LLSD& result, std::string upload_url);
-
+ void handleModelPhysicsFeeReceived();
/*virtual*/ void setModelPhysicsFeeErrorStatus(U32 status, const std::string& reason);
/*virtual*/ void onModelUploadSuccess();
@@ -273,6 +273,8 @@ protected:
LLToggleableMenu* mViewOptionMenu;
LLMutex* mStatusLock;
+ LLSD mModelPhysicsFee;
+
private:
void onClickCalculateBtn();
void toggleCalculateButton();
diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp
index a1f8f64627..6e67e580b4 100755
--- a/indra/newview/llmeshrepository.cpp
+++ b/indra/newview/llmeshrepository.cpp
@@ -34,6 +34,7 @@
#include "llagent.h"
#include "llappviewer.h"
#include "llbufferstream.h"
+#include "llcallbacklist.h"
#include "llcurl.h"
#include "lldatapacker.h"
#include "llfloatermodelpreview.h"
@@ -355,7 +356,6 @@ public:
cc = llsd_from_file("fake_upload_error.xml");
}
- llinfos << "completed" << llendl;
mThread->mPendingUploads--;
dump_llsd_to_file(cc,make_dump_name("whole_model_fee_response_",dump_num));
@@ -364,7 +364,6 @@ public:
if (isGoodStatus(status) &&
cc["state"].asString() == "upload")
{
- llinfos << "fee request succeeded" << llendl;
mThread->mWholeModelUploadURL = cc["uploader"].asString();
if (observer)
@@ -414,8 +413,7 @@ public:
//assert_main_thread();
mThread->mPendingUploads--;
dump_llsd_to_file(cc,make_dump_name("whole_model_upload_response_",dump_num));
- llinfos << "LLWholeModelUploadResponder content: " << cc << llendl;
-
+
LLWholeModelUploadObserver* observer = mObserverHandle.get();
// requested "mesh" asset type isn't actually the type
@@ -423,13 +421,12 @@ public:
if (isGoodStatus(status) &&
cc["state"].asString() == "complete")
{
- llinfos << "upload succeeded" << llendl;
mModelData["asset_type"] = "object";
gMeshRepo.updateInventory(LLMeshRepository::inventory_data(mModelData,cc));
if (observer)
{
- observer->onModelUploadSuccess();
+ doOnIdleOneTime(boost::bind(&LLWholeModelUploadObserver::onModelUploadSuccess, observer));
}
}
else
@@ -440,7 +437,7 @@ public:
if (observer)
{
- observer->onModelUploadFailure();
+ doOnIdleOneTime(boost::bind(&LLWholeModelUploadObserver::onModelUploadFailure, observer));
}
}
}