diff options
author | Armin Weatherwax | 2010-03-02 14:09:41 +0100 |
---|---|---|
committer | Armin Weatherwax | 2010-03-04 22:31:47 +0100 |
commit | 05115e1ef88d62d06b7ac4529a1a590276a5415d (patch) | |
tree | 99d2f954e88208fb37296ec45721e2464b52c368 /linden | |
parent | Imprudence 1.3.0 beta 1 released. (diff) | |
download | meta-impy-05115e1ef88d62d06b7ac4529a1a590276a5415d.zip meta-impy-05115e1ef88d62d06b7ac4529a1a590276a5415d.tar.gz meta-impy-05115e1ef88d62d06b7ac4529a1a590276a5415d.tar.bz2 meta-impy-05115e1ef88d62d06b7ac4529a1a590276a5415d.tar.xz |
Aleric Inglewood: SNOW-408 Fix the case for a non-valid handle but abort set.
Diffstat (limited to 'linden')
-rw-r--r-- | linden/doc/contributions.txt | 2 | ||||
-rw-r--r-- | linden/indra/newview/lltexturecache.cpp | 43 |
2 files changed, 30 insertions, 15 deletions
diff --git a/linden/doc/contributions.txt b/linden/doc/contributions.txt index 7b7d313..253c157 100644 --- a/linden/doc/contributions.txt +++ b/linden/doc/contributions.txt | |||
@@ -40,6 +40,7 @@ Aimee Trescothick | |||
40 | Alejandro Rosenthal | 40 | Alejandro Rosenthal |
41 | VWR-1184 | 41 | VWR-1184 |
42 | Aleric Inglewood | 42 | Aleric Inglewood |
43 | SNOW-408 | ||
43 | VWR-10759 | 44 | VWR-10759 |
44 | VWR-10837 | 45 | VWR-10837 |
45 | Alissa Sabre | 46 | Alissa Sabre |
@@ -68,6 +69,7 @@ Alissa Sabre | |||
68 | VWR-2826 | 69 | VWR-2826 |
69 | VWR-3290 | 70 | VWR-3290 |
70 | VWR-3410 | 71 | VWR-3410 |
72 | SNOW-408 | ||
71 | VWR-3857 | 73 | VWR-3857 |
72 | VWR-4010 | 74 | VWR-4010 |
73 | VWR-5575 | 75 | VWR-5575 |
diff --git a/linden/indra/newview/lltexturecache.cpp b/linden/indra/newview/lltexturecache.cpp index e0bef61..706e408 100644 --- a/linden/indra/newview/lltexturecache.cpp +++ b/linden/indra/newview/lltexturecache.cpp | |||
@@ -1484,26 +1484,39 @@ LLTextureCache::handle_t LLTextureCache::readFromCache(const LLUUID& id, U32 pri | |||
1484 | return handle; | 1484 | return handle; |
1485 | } | 1485 | } |
1486 | 1486 | ||
1487 | 1487 | // Return true if the handle is not valid, which is the case | |
1488 | // when the worker was already deleted or is scheduled for deletion. | ||
1489 | // | ||
1490 | // If the handle exists and a call to worker->complete() returns | ||
1491 | // true or abort is true, then the handle is removed and the worker | ||
1492 | // scheduled for deletion. | ||
1488 | bool LLTextureCache::readComplete(handle_t handle, bool abort) | 1493 | bool LLTextureCache::readComplete(handle_t handle, bool abort) |
1489 | { | 1494 | { |
1490 | lockWorkers(); | 1495 | lockWorkers(); // Needed for access to mReaders. |
1496 | |||
1491 | handle_map_t::iterator iter = mReaders.find(handle); | 1497 | handle_map_t::iterator iter = mReaders.find(handle); |
1492 | llassert_always(iter != mReaders.end() || abort); | 1498 | bool handle_is_valid = iter != mReaders.end(); |
1493 | LLTextureCacheWorker* worker = iter->second; | 1499 | llassert_always(handle_is_valid || abort); |
1494 | bool res = worker->complete(); | 1500 | LLTextureCacheWorker* worker = NULL; |
1495 | if (res || abort) | 1501 | bool delete_worker = false; |
1496 | { | 1502 | |
1497 | mReaders.erase(handle); | 1503 | if (handle_is_valid) |
1498 | unlockWorkers(); | ||
1499 | worker->scheduleDelete(); | ||
1500 | return true; | ||
1501 | } | ||
1502 | else | ||
1503 | { | 1504 | { |
1504 | unlockWorkers(); | 1505 | worker = iter->second; |
1505 | return false; | 1506 | delete_worker = worker->complete() || abort; |
1507 | if (delete_worker) | ||
1508 | { | ||
1509 | mReaders.erase(handle); | ||
1510 | handle_is_valid = false; | ||
1511 | } | ||
1506 | } | 1512 | } |
1513 | |||
1514 | unlockWorkers(); | ||
1515 | |||
1516 | if (delete_worker) worker->scheduleDelete(); | ||
1517 | |||
1518 | // Return false if the handle is (still) valid. | ||
1519 | return !handle_is_valid; | ||
1507 | } | 1520 | } |
1508 | 1521 | ||
1509 | LLTextureCache::handle_t LLTextureCache::writeToCache(const LLUUID& id, U32 priority, | 1522 | LLTextureCache::handle_t LLTextureCache::writeToCache(const LLUUID& id, U32 priority, |