Loading core/java/android/os/SharedMemory.java +9 −4 Original line number Diff line number Diff line Loading @@ -62,7 +62,7 @@ public final class SharedMemory implements Parcelable, Closeable { mMemoryRegistration = new MemoryRegistration(mSize); mCleaner = Cleaner.create(mFileDescriptor, new Closer(mFileDescriptor, mMemoryRegistration)); new Closer(mFileDescriptor.getInt$(), mMemoryRegistration)); } /** Loading Loading @@ -259,6 +259,9 @@ public final class SharedMemory implements Parcelable, Closeable { mCleaner.clean(); mCleaner = null; } // Cleaner.clean doesn't clear the value of the file descriptor. mFileDescriptor.setInt$(-1); } @Override Loading Loading @@ -290,10 +293,10 @@ public final class SharedMemory implements Parcelable, Closeable { * Cleaner that closes the FD */ private static final class Closer implements Runnable { private FileDescriptor mFd; private int mFd; private MemoryRegistration mMemoryReference; private Closer(FileDescriptor fd, MemoryRegistration memoryReference) { private Closer(int fd, MemoryRegistration memoryReference) { mFd = fd; mMemoryReference = memoryReference; } Loading @@ -301,7 +304,9 @@ public final class SharedMemory implements Parcelable, Closeable { @Override public void run() { try { Os.close(mFd); FileDescriptor fd = new FileDescriptor(); fd.setInt$(mFd); Os.close(fd); } catch (ErrnoException e) { /* swallow error */ } mMemoryReference.release(); mMemoryReference = null; Loading Loading
core/java/android/os/SharedMemory.java +9 −4 Original line number Diff line number Diff line Loading @@ -62,7 +62,7 @@ public final class SharedMemory implements Parcelable, Closeable { mMemoryRegistration = new MemoryRegistration(mSize); mCleaner = Cleaner.create(mFileDescriptor, new Closer(mFileDescriptor, mMemoryRegistration)); new Closer(mFileDescriptor.getInt$(), mMemoryRegistration)); } /** Loading Loading @@ -259,6 +259,9 @@ public final class SharedMemory implements Parcelable, Closeable { mCleaner.clean(); mCleaner = null; } // Cleaner.clean doesn't clear the value of the file descriptor. mFileDescriptor.setInt$(-1); } @Override Loading Loading @@ -290,10 +293,10 @@ public final class SharedMemory implements Parcelable, Closeable { * Cleaner that closes the FD */ private static final class Closer implements Runnable { private FileDescriptor mFd; private int mFd; private MemoryRegistration mMemoryReference; private Closer(FileDescriptor fd, MemoryRegistration memoryReference) { private Closer(int fd, MemoryRegistration memoryReference) { mFd = fd; mMemoryReference = memoryReference; } Loading @@ -301,7 +304,9 @@ public final class SharedMemory implements Parcelable, Closeable { @Override public void run() { try { Os.close(mFd); FileDescriptor fd = new FileDescriptor(); fd.setInt$(mFd); Os.close(fd); } catch (ErrnoException e) { /* swallow error */ } mMemoryReference.release(); mMemoryReference = null; Loading