Mercurial > traipse_dev
diff orpg/mapper/images.py @ 22:88cea66228d6 traipse_dev
Should fix Image Chache problem, does not fix memory leak.
author | sirebral |
---|---|
date | Sat, 25 Jul 2009 20:36:12 -0500 |
parents | 072ffc1d466f |
children | c54768cffbd4 |
line wrap: on
line diff
--- a/orpg/mapper/images.py Sat Jul 25 19:28:21 2009 -0500 +++ b/orpg/mapper/images.py Sat Jul 25 20:36:12 2009 -0500 @@ -122,23 +122,23 @@ finally: self.__lock.release() def __loadCacheThread(self, path, image_type, imageId): - try: - st = time.time() - while self.__fetching.has_key(path) and self.__fetching[path] is not False: - time.sleep(0.025) - if (time.time()-st) > 120: - open_rpg.get_component('log').log("Timeout: " + path, ORPG_GENERAL, True) - break - except: - self.__fetching[path] = False - open_rpg.get_component('log').log("Unable to resolve/open the specified URI; image was NOT loaded: " + path, - ORPG_GENERAL, True) - return - self.__lock.acquire() - try: - open_rpg.get_component('log').log("Adding Image to Queue from Cache: " + str(self.__cache[path]), ORPG_DEBUG) - self.__queue.put((self.__cache[path], image_type, imageId)) - finally: self.__lock.release() + if self.__cache.has_key(path): + try: + st = time.time() + while self.__fetching.has_key(path) and self.__fetching[path] is not False: + time.sleep(0.025) + if (time.time()-st) > 120: + open_rpg.get_component('log').log("Timeout: " + path, ORPG_GENERAL, True) + break + except: + del self.__fetching[path] + open_rpg.get_component('log').log("Unable to resolve/open the specified URI; image was NOT loaded: " + path, ORPG_GENERAL, True) + return + self.__lock.acquire() + try: + open_rpg.get_component('log').log("Adding Image to Queue from Cache: " + str(self.__cache[path]), ORPG_DEBUG) + self.__queue.put((self.__cache[path], image_type, imageId)) + finally: self.__lock.release() #Property Methods def _getCache(self):