diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/com/jogamp/opencl/CLContext.java | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/com/jogamp/opencl/CLContext.java b/src/com/jogamp/opencl/CLContext.java index e3b83ae7..c3bd0e3f 100644 --- a/src/com/jogamp/opencl/CLContext.java +++ b/src/com/jogamp/opencl/CLContext.java @@ -52,6 +52,7 @@ import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.HashSet; +import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; @@ -506,11 +507,14 @@ public class CLContext extends CLObjectResource { release(memoryObjects); release(samplers); - for (List<CLCommandQueue> queues : queuesMap.values()) { - release(queues); + synchronized(queuesMap) { + final Collection<List<CLCommandQueue>> queuesList = queuesMap.values(); + for( Iterator<List<CLCommandQueue>> queuesI = queuesList.iterator(); queuesI.hasNext(); ) { + release(queuesI.next()); + } } - }finally{ + } finally { int ret = platform.getContextBinding().clReleaseContext(ID); checkForError(ret, "error releasing context"); } |