Lock in Surface#destroy
Previously, destroy just directly called release, which was already locked. Now, destroy invokes some functions in native. This means if another thread is calling release during the destroy call, it could cause crashes. Test: Hard to repro bug Bug: 223412469 Change-Id: Ie6415f505bbc86505e3fe3ea2a0bea96a3e78ad3
This commit is contained in:
@@ -341,10 +341,12 @@ public class Surface implements Parcelable {
|
||||
*/
|
||||
@UnsupportedAppUsage
|
||||
public void destroy() {
|
||||
if (mNativeObject != 0) {
|
||||
nativeDestroy(mNativeObject);
|
||||
synchronized (mLock) {
|
||||
if (mNativeObject != 0) {
|
||||
nativeDestroy(mNativeObject);
|
||||
}
|
||||
release();
|
||||
}
|
||||
release();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user