Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMickael Istria2019-12-12 08:09:42 +0000
committerMickael Istria2019-12-12 09:49:24 +0000
commit049ef41111aa28b068b62d6e6385e664a96472b9 (patch)
treec45ec3865ff0f29e60096118ccaa516397309e88 /org.eclipse.jface.text
parent53921d098c5aaa810e52e3b3a2cd702e64fffdf5 (diff)
downloadeclipse.platform.text-049ef41111aa28b068b62d6e6385e664a96472b9.tar.gz
eclipse.platform.text-049ef41111aa28b068b62d6e6385e664a96472b9.tar.xz
eclipse.platform.text-049ef41111aa28b068b62d6e6385e664a96472b9.zip
fComputedProposals can be changed or reset to null by other operations. Add a check that fComputedProposals is still "bound" to current computation before applying results. Change-Id: If924044693dfc34013a0b9919f26c64049d6c947 Signed-off-by: Mickael Istria <mistria@redhat.com>
Diffstat (limited to 'org.eclipse.jface.text')
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/AsyncCompletionProposalPopup.java8
1 files changed, 5 insertions, 3 deletions
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/AsyncCompletionProposalPopup.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/AsyncCompletionProposalPopup.java
index ce724dd973f..e39bc2f3043 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/AsyncCompletionProposalPopup.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/AsyncCompletionProposalPopup.java
@@ -224,16 +224,18 @@ class AsyncCompletionProposalPopup extends CompletionProposalPopup {
fComputedProposals.add(0, computingProposal);
setProposals(fComputedProposals, false);
AtomicInteger remaining= new AtomicInteger(populateFutures.size());
+ final List<ICompletionProposal> requestSpecificProposals= fComputedProposals; //fComputedProposals can be changed/reset later
populateFutures= populateFutures.stream().map(future -> future.thenRun(() -> {
computingProposal.setRemaining(remaining.decrementAndGet());
if (remaining.get() == 0) {
- fComputedProposals.remove(computingProposal);
+ requestSpecificProposals.remove(computingProposal);
}
Control control= fContentAssistSubjectControlAdapter.getControl();
if (!control.isDisposed() && offset == fInvocationOffset) {
control.getDisplay().asyncExec(() -> {
- // Don't run anything if offset has changed while runnable was scheduled (i.e. filtering might have occurred for fast CA)
- if (offset != fInvocationOffset) {
+ // Skip if offset has changed while runnable was scheduled
+ // nor when completion "session" was modified or canceled.
+ if (offset != fInvocationOffset || fComputedProposals != requestSpecificProposals) {
return;
}
if (autoInsert

Back to the top