Skip to content

Commit

Permalink
fixed NPE in CLContext.release() which was indroduced in last commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
mbien committed Feb 9, 2011
1 parent 4bf655f commit 08fe29a
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/com/jogamp/opencl/CLContext.java
Expand Up @@ -483,9 +483,11 @@ public void removeCLErrorHandler(CLErrorHandler handler) {

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();
}
}
}

Expand All @@ -501,7 +503,10 @@ public synchronized void release() {
release(samplers);

for (CLDevice device : getDevices()) {
release(queuesMap.get(device));
Collection<CLCommandQueue> queues = queuesMap.get(device);
if(queues != null) {
release(queues);
}
}

}finally{
Expand Down

0 comments on commit 08fe29a

Please sign in to comment.