diff: abort background computation on new request

Fix issue, when slow async `doLoadRequest` could override recently updated request.

Steps to reproduce:
* Have diff with multiple files and slow `doLoadRequest`
* Wait till request for the first file is loaded
* Switch to the second file ("Loading" request is shown)
* Switch back to the first file (request is taken from cache and shown immediately)
* Wait
* Request for the second file is loaded and replaces active request // BUG
This commit is contained in:
Aleksey Pivovarov
2018-09-17 21:55:32 +03:00
parent 1cc47be301
commit 57d5b6f79d

View File

@@ -92,6 +92,7 @@ public abstract class CacheDiffRequestProcessor<T> extends DiffRequestProcessor
public void updateRequest(final boolean force, boolean useCache, @Nullable final ScrollToPolicy scrollToChangePolicy) {
ApplicationManager.getApplication().assertIsDispatchThread();
if (isDisposed()) return;
myQueue.abort();
final T requestProvider = getCurrentRequestProvider();
if (requestProvider == null) {