From 9213ca50cb8b2b4dbae14743aa45f4fbd79a252b Mon Sep 17 00:00:00 2001 From: Kirill Likhodedov Date: Thu, 22 May 2014 17:00:58 +0400 Subject: [PATCH] [log] IDEA-125309 One more fix for a possible deadlock General practice is not to invoke some external code under a lock. Here the result handler can safely be called before the lock: if new requests arrive, they will be added to the queue in request(), and a new background task will be started after result is handled. --- .../src/com/intellij/vcs/log/data/SingleTaskController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/data/SingleTaskController.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/data/SingleTaskController.java index 3a8158248569..24b2d2e2f3a8 100644 --- a/platform/vcs-log/impl/src/com/intellij/vcs/log/data/SingleTaskController.java +++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/data/SingleTaskController.java @@ -85,8 +85,8 @@ public abstract class SingleTaskController { * The result is immediately passed to the result handler specified in the constructor. */ protected final void taskCompleted(@NotNull Result result) { + myResultHandler.consume(result); synchronized (LOCK) { - myResultHandler.consume(result); if (myAwaitingRequests.isEmpty()) { myActive = false; }