Merge "Cursor leakage due to cancellation signal"
This commit is contained in:
@ -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();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user