SL-16106 LLScopedIncrement crash

master
Andrey Kleshchev 2021-11-22 21:58:30 +02:00
parent 835ca57cbd
commit f1245399df
2 changed files with 9 additions and 6 deletions

View File

@ -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;

View File

@ -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