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

Commit 35b7de4c authored by Christopher Tate's avatar Christopher Tate Committed by Gerrit Code Review
Browse files

Merge "Cursor leakage due to cancellation signal"

parents 76d5cdd8 55eda43a
Loading
Loading
Loading
Loading
+10 −3
Original line number Diff line number Diff line
@@ -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();
                            }