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,
sortOrder, cancellationSignal);
if (cursor != null) {
CursorToBulkCursorAdaptor adaptor = null;
try {
CursorToBulkCursorAdaptor adaptor = new CursorToBulkCursorAdaptor(
cursor, observer, getProviderName());
BulkCursorDescriptor d = adaptor.getBulkCursorDescriptor();
adaptor = new CursorToBulkCursorAdaptor(cursor, observer,
getProviderName());
cursor = null;
BulkCursorDescriptor d = adaptor.getBulkCursorDescriptor();
adaptor = null;
reply.writeNoException();
reply.writeInt(1);
d.writeToParcel(reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
} finally {
// Close cursor if an exception was thrown while constructing the adaptor.
if (adaptor != null) {
adaptor.close();
}
if (cursor != null) {
cursor.close();
}