diff options
Diffstat (limited to 'indra/newview')
-rwxr-xr-x | indra/newview/llappviewer.cpp | 31 | ||||
-rwxr-xr-x | indra/newview/llnotificationstorage.cpp | 10 | ||||
-rwxr-xr-x | indra/newview/llviewertexturelist.cpp | 22 | ||||
-rwxr-xr-x | indra/newview/llviewertexturelist.h | 3 |
4 files changed, 44 insertions, 22 deletions
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 4bf719ec31..dd6b2802cd 100755 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -4653,7 +4653,12 @@ void LLAppViewer::loadNameCache() llifstream name_cache_stream(filename); if(name_cache_stream.is_open()) { - LLAvatarNameCache::importFile(name_cache_stream); + if ( ! LLAvatarNameCache::importFile(name_cache_stream)) + { + LL_WARNS("AppInit") << "removing invalid '" << filename << "'" << LL_ENDL; + name_cache_stream.close(); + LLFile::remove(filename); + } } if (!gCacheName) return; @@ -4668,7 +4673,7 @@ void LLAppViewer::loadNameCache() } void LLAppViewer::saveNameCache() - { +{ // display names cache std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, "avatar_name_cache.xml"); @@ -4676,16 +4681,18 @@ void LLAppViewer::saveNameCache() if(name_cache_stream.is_open()) { LLAvatarNameCache::exportFile(name_cache_stream); -} - - if (!gCacheName) return; - - std::string name_cache; - name_cache = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, "name.cache"); - llofstream cache_file(name_cache); - if(cache_file.is_open()) - { - gCacheName->exportFile(cache_file); + } + + // real names cache + if (gCacheName) + { + std::string name_cache; + name_cache = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, "name.cache"); + llofstream cache_file(name_cache); + if(cache_file.is_open()) + { + gCacheName->exportFile(cache_file); + } } } diff --git a/indra/newview/llnotificationstorage.cpp b/indra/newview/llnotificationstorage.cpp index e9970de58c..3418b33d37 100755 --- a/indra/newview/llnotificationstorage.cpp +++ b/indra/newview/llnotificationstorage.cpp @@ -123,14 +123,18 @@ bool LLNotificationStorage::readNotifications(LLSD& pNotificationData, bool is_n { LLPointer<LLSDParser> parser = new LLSDXMLParser(); didFileRead = (parser->parse(notifyFile, pNotificationData, LLSDSerialize::SIZE_UNLIMITED) >= 0); + notifyFile.close(); + if (!didFileRead) { LL_WARNS("LLNotificationStorage") << "Failed to parse open notifications from file '" << mFileName - << "'" << LL_ENDL; + << "'" << LL_ENDL; + LLFile::remove(filename); + LL_WARNS("LLNotificationStorage") << "Removed invalid open notifications file '" << mFileName + << "'" << LL_ENDL; } } - - LL_INFOS("LLNotificationStorage") << "ending read '" << filename << "'" << LL_ENDL; + if (!didFileRead) { if(is_new_filename) diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp index 8c27ddc63c..0865d90005 100755 --- a/indra/newview/llviewertexturelist.cpp +++ b/indra/newview/llviewertexturelist.cpp @@ -165,7 +165,7 @@ void LLViewerTextureList::doPreloadImages() static std::string get_texture_list_name() { - return std::string("texture_list_") + gSavedSettings.getString("LoginLocation") + ".xml"; + return gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "texture_list_" + gSavedSettings.getString("LoginLocation") + ".xml"); } void LLViewerTextureList::doPrefetchImages() @@ -178,13 +178,22 @@ void LLViewerTextureList::doPrefetchImages() // Pre-fetch textures from last logout LLSD imagelist; - std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, get_texture_list_name()); + std::string filename = get_texture_list_name(); llifstream file; file.open(filename); if (file.is_open()) { - LLSDSerialize::fromXML(imagelist, file); - } + if ( ! LLSDSerialize::fromXML(imagelist, file) ) + { + file.close(); + LL_WARNS() << "XML parse error reading texture list '" << filename << "'" << LL_ENDL; + LL_WARNS() << "Removing invalid texture list '" << filename << "'" << LL_ENDL; + LLFile::remove(filename); + return; + } + file.close(); + } + S32 texture_count = 0; for (LLSD::array_iterator iter = imagelist.beginArray(); iter != imagelist.endArray(); ++iter) { @@ -198,10 +207,12 @@ void LLViewerTextureList::doPrefetchImages() LLViewerFetchedTexture* image = LLViewerTextureManager::getFetchedTexture(uuid, FTT_DEFAULT, MIPMAP_TRUE, LLGLTexture::BOOST_NONE, texture_type); if (image) { + texture_count += 1; image->addTextureStats((F32)pixel_area); } } } + LL_DEBUGS() << "fetched " << texture_count << " images from " << filename << LL_ENDL; } /////////////////////////////////////////////////////////////////////////////// @@ -261,9 +272,10 @@ void LLViewerTextureList::shutdown() if (count > 0 && !gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "").empty()) { - std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, get_texture_list_name()); + std::string filename = get_texture_list_name(); llofstream file; file.open(filename); + LL_DEBUGS() << "saving " << imagelist.size() << " image list entries" << LL_ENDL; LLSDSerialize::toPrettyXML(imagelist, file); } diff --git a/indra/newview/llviewertexturelist.h b/indra/newview/llviewertexturelist.h index 2f84d0947a..fbbfe9a7d4 100755 --- a/indra/newview/llviewertexturelist.h +++ b/indra/newview/llviewertexturelist.h @@ -61,8 +61,6 @@ typedef void (*LLImageCallback)(BOOL success, class LLViewerTextureList { - LOG_CLASS(LLViewerTextureList); - friend class LLTextureView; friend class LLViewerTextureManager; friend class LLLocalBitmap; @@ -206,6 +204,7 @@ private: private: static S32 sNumImages; static void (*sUUIDCallback)(void**, const LLUUID &); + LOG_CLASS(LLViewerTextureList); }; class LLUIImageList : public LLImageProviderInterface, public LLSingleton<LLUIImageList> |