From d278cef89a6a76216b01aa684366d054bbb9a362 Mon Sep 17 00:00:00 2001 From: Alexey Kudravtsev Date: Tue, 12 Nov 2013 18:56:53 +0400 Subject: [PATCH] EA-51538 - assert: PsiDocumentManagerBase.cancelAndRunWhenAllCommitted --- .../intellij/psi/impl/PsiDocumentManagerBase.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/platform/core-impl/src/com/intellij/psi/impl/PsiDocumentManagerBase.java b/platform/core-impl/src/com/intellij/psi/impl/PsiDocumentManagerBase.java index 8d7d9bb07453..e24771a51300 100644 --- a/platform/core-impl/src/com/intellij/psi/impl/PsiDocumentManagerBase.java +++ b/platform/core-impl/src/com/intellij/psi/impl/PsiDocumentManagerBase.java @@ -243,7 +243,9 @@ public abstract class PsiDocumentManagerBase extends PsiDocumentManager implemen } if (myUncommittedDocuments.isEmpty()) { action.run(); - assert actionsWhenAllDocumentsAreCommitted.isEmpty() : actionsWhenAllDocumentsAreCommitted; + if (!hasUncommitedDocuments()) { + assert actionsWhenAllDocumentsAreCommitted.isEmpty() : actionsWhenAllDocumentsAreCommitted; + } return true; } actionsWhenAllDocumentsAreCommitted.put(key, action); @@ -496,9 +498,14 @@ public abstract class PsiDocumentManagerBase extends PsiDocumentManager implemen if (!hasUncommitedDocuments() && !actionsWhenAllDocumentsAreCommitted.isEmpty()) { List keys = new ArrayList(actionsWhenAllDocumentsAreCommitted.keySet()); for (Object key : keys) { - Runnable action = actionsWhenAllDocumentsAreCommitted.remove(key); - myDocumentCommitProcessor.log("Running after commit runnable: ", null, false, key, action); - action.run(); + try { + Runnable action = actionsWhenAllDocumentsAreCommitted.remove(key); + myDocumentCommitProcessor.log("Running after commit runnable: ", null, false, key, action); + action.run(); + } + catch (Throwable e) { + LOG.error(e); + } } } }