diff options
author | teicher | 2004-06-17 15:53:34 +0000 |
---|---|---|
committer | teicher | 2004-06-17 15:53:34 +0000 |
commit | 7da9d908fd0cc055e6823bf98188f87fd4c02073 (patch) | |
tree | baf7486a2d76bc4743386208a2857d9e4059595f | |
parent | ea538b2308236f84d22ee19c56a2087a10190a2c (diff) | |
download | eclipse.platform.text-7da9d908fd0cc055e6823bf98188f87fd4c02073.tar.gz eclipse.platform.text-7da9d908fd0cc055e6823bf98188f87fd4c02073.tar.xz eclipse.platform.text-7da9d908fd0cc055e6823bf98188f87fd4c02073.zip |
fixes 40549 [reconciling] IllegalThreadStateException in reconciler
-rw-r--r-- | org.eclipse.jface.text/src/org/eclipse/jface/text/reconciler/AbstractReconciler.java | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/reconciler/AbstractReconciler.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/reconciler/AbstractReconciler.java index e1cf5013c3a..46f33d2532d 100644 --- a/org.eclipse.jface.text/src/org/eclipse/jface/text/reconciler/AbstractReconciler.java +++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/reconciler/AbstractReconciler.java @@ -423,6 +423,11 @@ abstract public class AbstractReconciler implements IReconciler { public void install(ITextViewer textViewer) { Assert.isNotNull(textViewer); + synchronized (this) { + if (fThread != null) + return; + fThread= new BackgroundThread(getClass().getName()); + } fViewer= textViewer; @@ -430,7 +435,6 @@ abstract public class AbstractReconciler implements IReconciler { fViewer.addTextInputListener(fListener); fDirtyRegionQueue= new DirtyRegionQueue(); - fThread= new BackgroundThread(getClass().getName()); } /* @@ -518,10 +522,18 @@ abstract public class AbstractReconciler implements IReconciler { if (fThread == null) return; - if (!fThread.isAlive()) - fThread.start(); - else + if (!fThread.isAlive()) { + try { + fThread.start(); + } catch (IllegalThreadStateException e) { + // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=40549 + // This is the only instance where the thread is started; since + // we checked that it is not alive, it must be dead already due + // to a run-time exception or error. Exit. + } + } else { fThread.reset(); + } } /** |