OSDN Git Service

Fix destruction issues relating to AllocationAdapter.
authorJason Sams <jsams@google.com>
Mon, 10 Mar 2014 20:32:42 +0000 (13:32 -0700)
committerJason Sams <jsams@google.com>
Mon, 10 Mar 2014 20:32:42 +0000 (13:32 -0700)
bug 13170046

Change-Id: I2a2ba3cbd7d08c659ed8958fbcc01919e36e86b0

graphics/java/android/renderscript/AllocationAdapter.java
graphics/java/android/renderscript/BaseObj.java

index a6645bb..84a9ad3 100644 (file)
@@ -224,7 +224,6 @@ public class AllocationAdapter extends Allocation {
     }
 
     static public AllocationAdapter create2D(RenderScript rs, Allocation a) {
-        android.util.Log.e("rs", "create2d " + a);
         rs.validate();
         AllocationAdapter aa = new AllocationAdapter(0, rs, a);
         aa.mConstrainedLOD = true;
index 6f2726e..fc54532 100644 (file)
@@ -122,7 +122,8 @@ public class BaseObj {
             // must include nObjDestroy in the critical section
             ReentrantReadWriteLock.ReadLock rlock = mRS.mRWLock.readLock();
             rlock.lock();
-            if(mRS.isAlive()) {
+            // AllocationAdapters are BaseObjs with an ID of 0 but should not be passed to nObjDestroy
+            if(mRS.isAlive() && mID != 0) {
                 mRS.nObjDestroy(mID);
             }
             rlock.unlock();