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

Commit 8e6f69b0 authored by Ben Komalo's avatar Ben Komalo
Browse files

Release resources for a previously loaded cursor if a new one

comes in.

Change-Id: I43b8788869d5bfdd06096de6cb23acdf26a1c19a
parent 07469fa7
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -55,8 +55,13 @@ public class CursorLoader extends AsyncTaskLoader<Cursor> {
            }
            return;
        }
        Cursor oldCursor = mCursor;
        mCursor = cursor;
        super.deliverResult(cursor);

        if (oldCursor != null && !oldCursor.isClosed()) {
            oldCursor.close();
        }
    }

    public CursorLoader(Context context, Uri uri, String[] projection, String selection,