Closed GoogleCodeExporter closed 9 years ago
I can confirm the bug but your patch is for pyglet.resource.image and doesn't
work.
Should we clear the cache on a reindex?
Original comment by Adam.JT...@gmail.com
on 10 Oct 2012 at 9:43
I tried resetting the cache when reindexing (reindexing should be done on path
changes anyway) and it fixes the problem. If no one updates their path
regularly then I think this fix is fine.
diff -r bf7f6c052756 pyglet/resource.py
--- a/pyglet/resource.py Sat Sep 15 16:48:08 2012 -0500
+++ b/pyglet/resource.py Wed Oct 10 22:47:13 2012 +0100
@@ -308,6 +308,9 @@
You must call this method if `path` is changed or the filesystem
layout changes.
'''
+ self._cached_textures = weakref.WeakValueDictionary()
+ self._cached_images = weakref.WeakValueDictionary()
+ self._cached_animations = weakref.WeakValueDictionary()
self._index = {}
for path in self.path:
if path.startswith('@'):
Original comment by Adam.JT...@gmail.com
on 10 Oct 2012 at 9:55
Nathan confirmed my fix and it is applied in changeset 9e151b2a47e4.
Original comment by Adam.JT...@gmail.com
on 4 Dec 2012 at 12:40
Original issue reported on code.google.com by
nathan.s...@gmail.com
on 10 Oct 2012 at 4:41Attachments: