summaryrefslogtreecommitdiff
path: root/indra/newview/llviewertexturelist.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llviewertexturelist.cpp')
-rwxr-xr-xindra/newview/llviewertexturelist.cpp22
1 files changed, 17 insertions, 5 deletions
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);
}