summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2021-11-22 21:58:30 +0200
committerAndrey Kleshchev <andreykproductengine@lindenlab.com>2021-11-22 22:09:24 +0200
commitf1245399df2e1ff9adef5ff23d3afe279aeb9eac (patch)
tree3297ca484da17549394d424bbeaa8b20a4ac85fa
parent835ca57cbd81e54aec8ff1ac331caff9b550a8a7 (diff)
SL-16106 LLScopedIncrement crash
-rw-r--r--indra/newview/llviewerassetstorage.cpp12
-rw-r--r--indra/newview/llviewerassetstorage.h3
2 files changed, 9 insertions, 6 deletions
diff --git a/indra/newview/llviewerassetstorage.cpp b/indra/newview/llviewerassetstorage.cpp
index 64d9ce62c5..8c8de22b2f 100644
--- a/indra/newview/llviewerassetstorage.cpp
+++ b/indra/newview/llviewerassetstorage.cpp
@@ -103,12 +103,13 @@ public:
/// LLViewerAssetStorage
///----------------------------------------------------------------------------
+S32 LLViewerAssetStorage::sAssetCoroCount = 0;
+
// Unused?
LLViewerAssetStorage::LLViewerAssetStorage(LLMessageSystem *msg, LLXferManager *xfer,
LLVFS *vfs, LLVFS *static_vfs,
const LLHost &upstream_host)
: LLAssetStorage(msg, xfer, vfs, static_vfs, upstream_host),
- mAssetCoroCount(0),
mCountRequests(0),
mCountStarted(0),
mCountCompleted(0),
@@ -122,7 +123,6 @@ LLViewerAssetStorage::LLViewerAssetStorage(LLMessageSystem *msg, LLXferManager *
LLViewerAssetStorage::LLViewerAssetStorage(LLMessageSystem *msg, LLXferManager *xfer,
LLVFS *vfs, LLVFS *static_vfs)
: LLAssetStorage(msg, xfer, vfs, static_vfs),
- mAssetCoroCount(0),
mCountRequests(0),
mCountStarted(0),
mCountCompleted(0),
@@ -491,8 +491,7 @@ void LLViewerAssetStorage::assetRequestCoro(
LLGetAssetCallback callback,
void *user_data)
{
- LLScopedIncrement coro_count_boost(mAssetCoroCount);
- mCountStarted++;
+ LLScopedIncrement coro_count_boost(sAssetCoroCount); // static counter since corotine can outlive LLViewerAssetStorage
S32 result_code = LL_ERR_NOERR;
LLExtStat ext_status = LLExtStat::NONE;
@@ -502,6 +501,9 @@ void LLViewerAssetStorage::assetRequestCoro(
LL_WARNS_ONCE("ViewerAsset") << "Asset request fails: asset storage no longer exists" << LL_ENDL;
return;
}
+
+ mCountStarted++;
+
if (!gAgent.getRegion())
{
LL_WARNS_ONCE("ViewerAsset") << "Asset request fails: no region set" << LL_ENDL;
@@ -628,7 +630,7 @@ std::string LLViewerAssetStorage::getAssetURL(const std::string& cap_url, const
void LLViewerAssetStorage::logAssetStorageInfo()
{
LLMemory::logMemoryInfo(true);
- LL_INFOS("AssetStorage") << "Active coros " << mAssetCoroCount << LL_ENDL;
+ LL_INFOS("AssetStorage") << "Active coros " << sAssetCoroCount << LL_ENDL;
LL_INFOS("AssetStorage") << "mPendingDownloads size " << mPendingDownloads.size() << LL_ENDL;
LL_INFOS("AssetStorage") << "mCountStarted " << mCountStarted << LL_ENDL;
LL_INFOS("AssetStorage") << "mCountCompleted " << mCountCompleted << LL_ENDL;
diff --git a/indra/newview/llviewerassetstorage.h b/indra/newview/llviewerassetstorage.h
index c1a5534b81..cdf6401e4e 100644
--- a/indra/newview/llviewerassetstorage.h
+++ b/indra/newview/llviewerassetstorage.h
@@ -124,12 +124,13 @@ protected:
wait_list_t mCoroWaitList;
std::string mViewerAssetUrl;
- S32 mAssetCoroCount;
S32 mCountRequests;
S32 mCountStarted;
S32 mCountCompleted;
S32 mCountSucceeded;
S64 mTotalBytesFetched;
+
+ static S32 sAssetCoroCount; // coroutine count, static since coroutines can outlive LLViewerAssetStorage
};
#endif