am f1fbe113: am 4ba1bbad: am 5fbcb134: am 35b7de4c: Merge "Cursor leakage due to cancellation signal"

* commit 'f1fbe1135a2872a7287f5c06af211cf780f16598':
  Cursor leakage due to cancellation signal
This commit is contained in:
Christopher Tate
2014-01-09 20:53:45 +00:00
committed by Android Git Automerger

View File

@ -112,17 +112,24 @@ abstract public class ContentProviderNative extends Binder implements IContentPr
Cursor cursor = query(callingPkg, url, projection, selection, selectionArgs, Cursor cursor = query(callingPkg, url, projection, selection, selectionArgs,
sortOrder, cancellationSignal); sortOrder, cancellationSignal);
if (cursor != null) { if (cursor != null) {
CursorToBulkCursorAdaptor adaptor = null;
try { try {
CursorToBulkCursorAdaptor adaptor = new CursorToBulkCursorAdaptor( adaptor = new CursorToBulkCursorAdaptor(cursor, observer,
cursor, observer, getProviderName()); getProviderName());
BulkCursorDescriptor d = adaptor.getBulkCursorDescriptor();
cursor = null; cursor = null;
BulkCursorDescriptor d = adaptor.getBulkCursorDescriptor();
adaptor = null;
reply.writeNoException(); reply.writeNoException();
reply.writeInt(1); reply.writeInt(1);
d.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE); d.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
} finally { } finally {
// Close cursor if an exception was thrown while constructing the adaptor. // Close cursor if an exception was thrown while constructing the adaptor.
if (adaptor != null) {
adaptor.close();
}
if (cursor != null) { if (cursor != null) {
cursor.close(); cursor.close();
} }