Fix crash due to race on close()
It's possible for close to be called during local cleanup concurrently with the remote call. A recent change (ag/15993920) added a missing Binder.unlinkToDeath call to close(). This now causes a crash now if the registration was removed at just the right time in another thread. This synchronizes access to close() to avoid this. Bug: 237406501 Test: atest ScrollCaptureConnectionTest Change-Id: I0126bfac1efdece2e4eff144a44f29a963553b74
This commit is contained in:
@@ -214,7 +214,7 @@ public class ScrollCaptureConnection extends IScrollCaptureConnection.Stub imple
|
||||
|
||||
@BinderThread
|
||||
@Override
|
||||
public void close() {
|
||||
public synchronized void close() {
|
||||
Trace.instantForTrack(TRACE_TAG_GRAPHICS, TRACE_TRACK, "close");
|
||||
if (mActive) {
|
||||
Log.w(TAG, "close(): capture session still active! Ending now.");
|
||||
|
||||
Reference in New Issue
Block a user