summaryrefslogtreecommitdiff
path: root/support
diff options
context:
space:
mode:
authorYang Ni <yangni@google.com>2016-04-04 10:26:20 -0700
committerYang Ni <yangni@google.com>2016-04-04 18:01:30 -0700
commit58ac3c4542b7e8c938a92b9215e8d9bdb7fe4e29 (patch)
tree0d1d27142fc2ff1ba0ad449d79fbe0a87049d1b3 /support
parent17c0109763c504c15876b1e9096444c539326099 (diff)
downloadrs-58ac3c4542b7e8c938a92b9215e8d9bdb7fe4e29.tar.gz
Avoid destroying Device separately
Bug: 27983025 Device should be destroyed inside the destructor of the associated Context. Change-Id: I921a89974e1174f837349a89aef9b03efa4882f5 (cherry picked from commit 93b91f73e0a96bedce66e6e8ff0813b051f13892)
Diffstat (limited to 'support')
-rw-r--r--support/java/src/android/support/v8/renderscript/RenderScript.java19
1 files changed, 4 insertions, 15 deletions
diff --git a/support/java/src/android/support/v8/renderscript/RenderScript.java b/support/java/src/android/support/v8/renderscript/RenderScript.java
index 6fc9d5db..85b6763b 100644
--- a/support/java/src/android/support/v8/renderscript/RenderScript.java
+++ b/support/java/src/android/support/v8/renderscript/RenderScript.java
@@ -798,12 +798,10 @@ public class RenderScript {
}
mIncLoaded = true;
}
- if (mIncDev == 0) {
- mIncDev = nIncDeviceCreate();
- }
if (mIncCon == 0) {
//Create a dummy compat context (synchronous).
- mIncCon = nIncContextCreate(mIncDev, 0, 0, 0);
+ long device = nIncDeviceCreate();
+ mIncCon = nIncContextCreate(device, 0, 0, 0);
}
return rsnScriptIntrinsicCreate(mIncCon, id, eid, mUseInc);
} else {
@@ -1046,10 +1044,8 @@ public class RenderScript {
return rsnIncAllocationCreateTyped(mContext, mIncCon, alloc, type, xBytesSize);
}
- long mDev;
long mContext;
//Dummy device & context for Inc Support Lib
- long mIncDev;
long mIncCon;
//indicator of whether inc support lib has been loaded or not.
boolean mIncLoaded;
@@ -1350,7 +1346,6 @@ public class RenderScript {
mNativeLibDir = mApplicationContext.getApplicationInfo().nativeLibraryDir;
}
}
- mIncDev = 0;
mIncCon = 0;
mIncLoaded = false;
mRWLock = new ReentrantReadWriteLock();
@@ -1481,8 +1476,8 @@ public class RenderScript {
}
}
- rs.mDev = rs.nDeviceCreate();
- rs.mContext = rs.nContextCreate(rs.mDev, 0, sdkVersion, ct.mID, rs.mNativeLibDir);
+ long device = rs.nDeviceCreate();
+ rs.mContext = rs.nContextCreate(device, 0, sdkVersion, ct.mID, rs.mNativeLibDir);
rs.mContextType = ct;
rs.mContextFlags = flags;
rs.mContextSdkVersion = sdkVersion;
@@ -1703,12 +1698,6 @@ public class RenderScript {
}
nContextDestroy();
- nDeviceDestroy(mDev);
- if (mIncDev != 0) {
- nIncDeviceDestroy(mIncDev);
- mIncDev = 0;
- }
- mDev = 0;
}
boolean isAlive() {