Browse Source

fix for pool cleanup

Joe Shochet 19 years ago
parent
commit
c2bcda6260
1 changed files with 4 additions and 3 deletions
  1. 4 3
      direct/src/showbase/Pool.py

+ 4 - 3
direct/src/showbase/Pool.py

@@ -101,9 +101,10 @@ class Pool:
         cleanupFunc will be called on every free and used item.
         cleanupFunc will be called on every free and used item.
         """
         """
         if cleanupFunc:
         if cleanupFunc:
-            for item in self.__free:
-                cleanupFunc(item)
-            for item in self.__used:
+            # Make a list of all the items first in case the act of
+            # calling cleanupFunc moves some from used to free.
+            allItems = self.__free + self.__used
+            for item in allItems:
                 cleanupFunc(item)
                 cleanupFunc(item)
         del self.__free
         del self.__free
         del self.__used
         del self.__used