Backed out changeset ca8d1e1caeef for not fixing review comments

I managed to land the unfixed version - we should be closing the cursor before adding
a LeakCanary watcher, or else we have a greater probability of a race condition.

MozReview-Commit-ID: JuP15Tkj1hz
This commit is contained in:
Andrzej Hunt 2016-03-18 11:42:08 -07:00
parent 4ca8060282
commit 51bde91b05

View File

@ -23,8 +23,6 @@ import android.content.Context;
import android.database.Cursor;
import android.support.v4.content.AsyncTaskLoader;
import org.mozilla.gecko.GeckoApplication;
/**
* A copy of the framework's {@link android.content.CursorLoader} that
* instead allows the caller to load the Cursor themselves via the abstract
@ -89,10 +87,6 @@ abstract class SimpleCursorLoader extends AsyncTaskLoader<Cursor> {
}
if (oldCursor != null && oldCursor != cursor && !oldCursor.isClosed()) {
// Trying to read from the closed cursor will cause crashes, hence we should make
// sure that no adapters/LoaderCallbacks are holding onto this cursor.
GeckoApplication.getRefWatcher(getContext()).watch(oldCursor);
oldCursor.close();
}
}