Browse Source

AssetManager ImplHandler: synchronized access in clearCache()

shadowislord 10 years ago
parent
commit
ca497f458a
1 changed files with 4 additions and 2 deletions
  1. 4 2
      jme3-core/src/main/java/com/jme3/asset/ImplHandler.java

+ 4 - 2
jme3-core/src/main/java/com/jme3/asset/ImplHandler.java

@@ -204,8 +204,10 @@ public class ImplHandler {
     
     
     public void clearCache(){
     public void clearCache(){
         // The iterator of the values collection is thread safe
         // The iterator of the values collection is thread safe
-        for (AssetCache cache : classToCacheMap.values()){
-            cache.clearCache();
+        synchronized (classToCacheMap) {
+            for (AssetCache cache : classToCacheMap.values()){
+                cache.clearCache();
+            }
         }
         }
     }
     }