summaryrefslogtreecommitdiffstats
path: root/src/com/jogamp/opencl/CLContext.java
diff options
context:
space:
mode:
authorMichael Bien <[email protected]>2011-02-09 18:16:23 +0100
committerMichael Bien <[email protected]>2011-02-09 18:16:23 +0100
commit08fe29a8696a2c77c1d24a637dfb54af2537afe7 (patch)
treee58076a8562630c88d52c3e07ba0bda9e612f1ed /src/com/jogamp/opencl/CLContext.java
parent4bf655ff4be8c92e6e9911555c04b9efbc4f0e15 (diff)
fixed NPE in CLContext.release() which was indroduced in last commit.
Diffstat (limited to 'src/com/jogamp/opencl/CLContext.java')
-rw-r--r--src/com/jogamp/opencl/CLContext.java13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/com/jogamp/opencl/CLContext.java b/src/com/jogamp/opencl/CLContext.java
index b7ddb813..240f6d00 100644
--- a/src/com/jogamp/opencl/CLContext.java
+++ b/src/com/jogamp/opencl/CLContext.java
@@ -483,9 +483,11 @@ public class CLContext extends CLObject implements CLResource {
private void release(Collection<? extends CLResource> resources) {
// resources remove themselves when released, see above
- CLResource[] array = resources.toArray(new CLResource[resources.size()]);
- for (CLResource resource : array) {
- resource.release();
+ if(!resources.isEmpty()) {
+ CLResource[] array = resources.toArray(new CLResource[resources.size()]);
+ for (CLResource resource : array) {
+ resource.release();
+ }
}
}
@@ -501,7 +503,10 @@ public class CLContext extends CLObject implements CLResource {
release(samplers);
for (CLDevice device : getDevices()) {
- release(queuesMap.get(device));
+ Collection<CLCommandQueue> queues = queuesMap.get(device);
+ if(queues != null) {
+ release(queues);
+ }
}
}finally{