diff options
author | Jacek Antonelli | 2010-09-24 22:33:52 -0500 |
---|---|---|
committer | Jacek Antonelli | 2010-09-24 22:34:04 -0500 |
commit | 061bdfdf201aef0e85a285138515673c5811eeda (patch) | |
tree | ff649943aa4b090217687d4ed1e42f60c8e76660 /linden/indra | |
parent | Tiny layout tweaks to accomodate different font widths. (diff) | |
download | meta-impy-061bdfdf201aef0e85a285138515673c5811eeda.zip meta-impy-061bdfdf201aef0e85a285138515673c5811eeda.tar.gz meta-impy-061bdfdf201aef0e85a285138515673c5811eeda.tar.bz2 meta-impy-061bdfdf201aef0e85a285138515673c5811eeda.tar.xz |
Possible fix for an infinite loop in LLTextureCache.
Backported a few changes from pre-LGPL Viewer 2.
Diffstat (limited to '')
-rw-r--r-- | linden/indra/newview/lltexturecache.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/linden/indra/newview/lltexturecache.cpp b/linden/indra/newview/lltexturecache.cpp index 5548bc9..0ca235f 100644 --- a/linden/indra/newview/lltexturecache.cpp +++ b/linden/indra/newview/lltexturecache.cpp | |||
@@ -1169,7 +1169,7 @@ void LLTextureCache::readHeaderCache() | |||
1169 | { | 1169 | { |
1170 | Entry& entry = entries[i]; | 1170 | Entry& entry = entries[i]; |
1171 | const LLUUID& id = entry.mID; | 1171 | const LLUUID& id = entry.mID; |
1172 | if (entry.mImageSize < 0) | 1172 | if (entry.mImageSize <= 0) |
1173 | { | 1173 | { |
1174 | // This will be in the Free List, don't put it in the LRU | 1174 | // This will be in the Free List, don't put it in the LRU |
1175 | ++empty_entries; | 1175 | ++empty_entries; |
@@ -1182,7 +1182,7 @@ void LLTextureCache::readHeaderCache() | |||
1182 | if (entry.mBodySize > entry.mImageSize) | 1182 | if (entry.mBodySize > entry.mImageSize) |
1183 | { | 1183 | { |
1184 | // Shouldn't happen, failsafe only | 1184 | // Shouldn't happen, failsafe only |
1185 | llwarns << "Bad entry: " << i << ": " << id << ": BodySize: " << entry.mBodySize << llendl; | 1185 | llwarns << "Bad entry: " << i << ": " << entry.mID << ": BodySize: " << entry.mBodySize << llendl; |
1186 | purge_list.push_back(id); | 1186 | purge_list.push_back(id); |
1187 | } | 1187 | } |
1188 | } | 1188 | } |
@@ -1193,15 +1193,17 @@ void LLTextureCache::readHeaderCache() | |||
1193 | // Special case: cache size was reduced, need to remove entries | 1193 | // Special case: cache size was reduced, need to remove entries |
1194 | // Note: After we prune entries, we will call this again and create the LRU | 1194 | // Note: After we prune entries, we will call this again and create the LRU |
1195 | U32 entries_to_purge = (num_entries-empty_entries) - sCacheMaxEntries; | 1195 | U32 entries_to_purge = (num_entries-empty_entries) - sCacheMaxEntries; |
1196 | llinfos << "Texture Cache Entries: " << num_entries << " Max: " << sCacheMaxEntries << " Empty: " << empty_entries << " Purging: " << entries_to_purge << llendl; | ||
1196 | if (entries_to_purge > 0) | 1197 | if (entries_to_purge > 0) |
1197 | { | 1198 | { |
1198 | for (std::set<lru_data_t>::iterator iter = lru.begin(); iter != lru.end(); ++iter) | 1199 | for (std::set<lru_data_t>::iterator iter = lru.begin(); iter != lru.end(); ++iter) |
1199 | { | 1200 | { |
1200 | purge_list.push_back(iter->second); | 1201 | purge_list.push_back(iter->second); |
1201 | if (--entries_to_purge <= 0) | 1202 | if (purge_list.size() >= entries_to_purge) |
1202 | break; | 1203 | break; |
1203 | } | 1204 | } |
1204 | } | 1205 | } |
1206 | llassert_always(purge_list.size() >= entries_to_purge); | ||
1205 | } | 1207 | } |
1206 | else | 1208 | else |
1207 | { | 1209 | { |
@@ -1229,13 +1231,14 @@ void LLTextureCache::readHeaderCache() | |||
1229 | for (U32 i=0; i<num_entries; i++) | 1231 | for (U32 i=0; i<num_entries; i++) |
1230 | { | 1232 | { |
1231 | const Entry& entry = entries[i]; | 1233 | const Entry& entry = entries[i]; |
1232 | if (entry.mImageSize >=0) | 1234 | if (entry.mImageSize > 0) |
1233 | { | 1235 | { |
1234 | new_entries.push_back(entry); | 1236 | new_entries.push_back(entry); |
1235 | } | 1237 | } |
1236 | } | 1238 | } |
1237 | llassert_always(new_entries.size() <= sCacheMaxEntries); | 1239 | llassert_always(new_entries.size() <= sCacheMaxEntries); |
1238 | mHeaderEntriesInfo.mEntries = new_entries.size(); | 1240 | mHeaderEntriesInfo.mEntries = new_entries.size(); |
1241 | writeEntriesHeader(); | ||
1239 | writeEntriesAndClose(new_entries); | 1242 | writeEntriesAndClose(new_entries); |
1240 | mHeaderMutex.unlock(); // unlock the mutex before calling again | 1243 | mHeaderMutex.unlock(); // unlock the mutex before calling again |
1241 | readHeaderCache(); // repeat with new entries file | 1244 | readHeaderCache(); // repeat with new entries file |
@@ -1243,7 +1246,7 @@ void LLTextureCache::readHeaderCache() | |||
1243 | } | 1246 | } |
1244 | else | 1247 | else |
1245 | { | 1248 | { |
1246 | writeEntriesAndClose(entries); | 1249 | //entries are not changed, nothing here. |
1247 | } | 1250 | } |
1248 | } | 1251 | } |
1249 | } | 1252 | } |