From 57d5b6f79d76f0b8dc0ca2ecd2c84e514157b86d Mon Sep 17 00:00:00 2001 From: Aleksey Pivovarov Date: Mon, 17 Sep 2018 21:55:32 +0300 Subject: [PATCH] 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 --- .../src/com/intellij/diff/impl/CacheDiffRequestProcessor.java | 1 + 1 file changed, 1 insertion(+) diff --git a/platform/diff-impl/src/com/intellij/diff/impl/CacheDiffRequestProcessor.java b/platform/diff-impl/src/com/intellij/diff/impl/CacheDiffRequestProcessor.java index 6f1feedcf0bc..537d101343b5 100644 --- a/platform/diff-impl/src/com/intellij/diff/impl/CacheDiffRequestProcessor.java +++ b/platform/diff-impl/src/com/intellij/diff/impl/CacheDiffRequestProcessor.java @@ -92,6 +92,7 @@ public abstract class CacheDiffRequestProcessor 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) {