SurfaceControl: Fix release
Currently we call decStrong causing ~SurfaceControl to be invoked. If mOwned=true this will cause a reparent to null which is not the intended behavior of release. We call SurfaceControl#release before decStrong to fix this. Also we have destroy call destroy to be less confusing. Bug: 123587983 Test: SurfaceControlTest Change-Id: I86faa9d1eb850ac6437fc870b126a1473ee091e3
This commit is contained in:
@@ -178,12 +178,13 @@ static jlong nativeCreate(JNIEnv* env, jclass clazz, jobject sessionObj,
|
||||
|
||||
static void nativeRelease(JNIEnv* env, jclass clazz, jlong nativeObject) {
|
||||
sp<SurfaceControl> ctrl(reinterpret_cast<SurfaceControl *>(nativeObject));
|
||||
ctrl->release();
|
||||
ctrl->decStrong((void *)nativeCreate);
|
||||
}
|
||||
|
||||
static void nativeDestroy(JNIEnv* env, jclass clazz, jlong nativeObject) {
|
||||
sp<SurfaceControl> ctrl(reinterpret_cast<SurfaceControl *>(nativeObject));
|
||||
ctrl->clear();
|
||||
ctrl->destroy();
|
||||
ctrl->decStrong((void *)nativeCreate);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user