diff options
| author | Erik Kundiman <erik@megapahit.org> | 2026-08-18 13:57:14 +0800 |
|---|---|---|
| committer | Erik Kundiman <erik@megapahit.org> | 2026-08-18 13:57:14 +0800 |
| commit | 2fa8281b2d8ce8bdbcacf139ec674480da6c9d81 (patch) | |
| tree | ffb343fee97f21942123fd322d88fea3ef1a4811 /indra/newview/llinventorymodel.cpp | |
| parent | 742d802f073e81abc6d4cd512e58a4d03b414b83 (diff) | |
| parent | 214fa765986b4c1e1de1b917581f8508278abd8e (diff) | |
Merge branch '26.3'
Diffstat (limited to 'indra/newview/llinventorymodel.cpp')
| -rw-r--r-- | indra/newview/llinventorymodel.cpp | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index a8bc3b361e..2657f11d0e 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -433,6 +433,8 @@ LLInventoryModel::LLInventoryModel() : // These are now ordered, keep them that way. mBacklinkMMap(), mIsAgentInvUsable(false), + mLibrarySkeletonLoadTime(0.f), + mAgentSkeletonLoadTime(0.f), mRootFolderID(), mLibraryRootFolderID(), mLibraryOwnerID(), @@ -2383,10 +2385,22 @@ void LLInventoryModel::cache( items, INCLUDE_TRASH, can_cache); + + if (categories.empty() && items.empty()) + { + LL_WARNS(LOG_INV) << "Nothing to cache for " << parent_folder_id << LL_ENDL; + return; + } + // Use temporary file to avoid potential conflicts with other // instances (even a 'read only' instance unzips into a file) std::string temp_file = gDirUtilp->getTempFilename(); - saveToFile(temp_file, categories, items); + if (!saveToFile(temp_file, categories, items)) + { + LL_WARNS(LOG_INV) << "Failed to save inventory cache for " << parent_folder_id << LL_ENDL; + LLFile::remove(temp_file); + return; + } std::string gzip_filename = getInvCacheAddres(agent_id); gzip_filename.append(".gz"); if(gzip_file(temp_file, gzip_filename)) @@ -2989,6 +3003,16 @@ bool LLInventoryModel::loadSkeleton( << " after " << timer.getElapsedTimeF32() << " seconds." << LL_ENDL; + const F32 elapsed = timer.getElapsedTimeF32(); + if (owner_id == mLibraryOwnerID) + { + mLibrarySkeletonLoadTime = elapsed; + } + else + { + mAgentSkeletonLoadTime = elapsed; + } + return rv; } @@ -3537,6 +3561,11 @@ bool LLInventoryModel::saveToFile(const std::string& filename, S32 cat_count = 0; for (auto& cat : categories) { + if (cat.isNull()) + { + LL_WARNS(LOG_INV) << "Skipping null category during inventory save" << LL_ENDL; + continue; + } if (cat->getVersion() != LLViewerInventoryCategory::VERSION_UNKNOWN) { LLSD sd; @@ -3551,6 +3580,11 @@ bool LLInventoryModel::saveToFile(const std::string& filename, auto it_count = items.size(); for (auto& item : items) { + if (item.isNull()) + { + LL_WARNS(LOG_INV) << "Skipping null item during inventory save" << LL_ENDL; + continue; + } LLSD sd; item->asLLSD(sd); item_array.append(sd); @@ -3567,6 +3601,12 @@ bool LLInventoryModel::saveToFile(const std::string& filename, LL_INFOS(LOG_INV) << "Inventory saved: " << (S32)cat_count << " categories, " << (S32)it_count << " items." << LL_ENDL; } + catch(std::bad_alloc&) + { + // We are quiting, so just log an error and move on. + LL_WARNS(LOG_INV) << "Failed to save inventory to cache due to memory allocation failure." << LL_ENDL; + return false; + } catch (...) { LOG_UNHANDLED_EXCEPTION(""); |
