You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@OverrideprotectedvoidonStartLoading() {
if (result != null) {
deliverResult(result);
} else {
forceLoad();
}
}
@OverridepublicvoiddeliverResult(Result<E> data) {
if (isReset()) {
if (result != null) {
result.close();
}
return;
}
Result<E> previous = result;
result = data;
if (isStarted()) {
super.deliverResult(result);
}
if (previous != null) {
previous.close();
}
}
As it is a Loader, it tries to use the previous results if available (onStartLoading()'s deliverResult(result);). This is cool, but the problem is that deliverResult(...) does not check whether the previous result is the same as the new one, and closes it anyway. This results in IllegalStateException when trying to use the same result again as it has been closed.
There's a quick fix for the problem in deliverResult(...), instead of
if (previous != null) {
previous.close();
}
it should check whether the previous and current results are different objects:
Here are two methods of
QueryLoader
:As it is a
Loader
, it tries to use the previous results if available (onStartLoading()
'sdeliverResult(result);
). This is cool, but the problem is thatdeliverResult(...)
does not check whether the previous result is the same as the new one, and closes it anyway. This results inIllegalStateException
when trying to use the same result again as it has been closed.There's a quick fix for the problem in
deliverResult(...)
, instead ofit should check whether the previous and current results are different objects:
The text was updated successfully, but these errors were encountered: