Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a433556f authored by Mark Renouf's avatar Mark Renouf
Browse files

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
parent 0251a892
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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.");