Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDani Megert2004-06-18 14:05:37 +0000
committerDani Megert2004-06-18 14:05:37 +0000
commita1798867be179daa059ee896a23596ad78d51d34 (patch)
treeceaf753e181ef1296070fdf5eddca627e95bfcbf
parente6b903bfee5e5ffa720c4ac9fbd5f44fa748e941 (diff)
downloadeclipse.platform.text-a1798867be179daa059ee896a23596ad78d51d34.tar.gz
eclipse.platform.text-a1798867be179daa059ee896a23596ad78d51d34.tar.xz
eclipse.platform.text-a1798867be179daa059ee896a23596ad78d51d34.zip
Fixed bug 67424: Deadlock in AnnotationPainter
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/source/AnnotationPainter.java26
1 files changed, 16 insertions, 10 deletions
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/AnnotationPainter.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/AnnotationPainter.java
index a68d5f426e7..fdd01ba0e64 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/AnnotationPainter.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/AnnotationPainter.java
@@ -251,7 +251,7 @@ public class AnnotationPainter implements IPainter, PaintListener, IAnnotationMo
/** Indicates whether this painter is managing decorations */
private boolean fIsPainting= false;
/** Indicates whether this painter is setting its annotation model */
- private boolean fIsSettingModel= false;
+ private volatile boolean fIsSettingModel= false;
/** The associated source viewer */
private ISourceViewer fSourceViewer;
/** The cached widget of the source viewer */
@@ -402,13 +402,11 @@ public class AnnotationPainter implements IPainter, PaintListener, IAnnotationMo
fModel.removeAnnotationModelListener(this);
fModel= model;
if (fModel != null) {
- synchronized(this) {
- try {
- fIsSettingModel= true;
- fModel.addAnnotationModelListener(this);
- } finally {
- fIsSettingModel= false;
- }
+ try {
+ fIsSettingModel= true;
+ fModel.addAnnotationModelListener(this);
+ } finally {
+ fIsSettingModel= false;
}
}
}
@@ -891,11 +889,19 @@ public class AnnotationPainter implements IPainter, PaintListener, IAnnotationMo
/*
* @see IAnnotationModelListenerExtension#modelChanged(AnnotationModelEvent)
*/
- public synchronized void modelChanged(final AnnotationModelEvent event) {
+ public void modelChanged(final AnnotationModelEvent event) {
if (fTextWidget != null && !fTextWidget.isDisposed()) {
if (fIsSettingModel) {
// inside the UI thread -> no need for posting
- updatePainting(event);
+ if (fTextWidget.getDisplay() == Display.getCurrent())
+ updatePainting(event);
+ else {
+ /*
+ * we can throw away the changes since
+ * further update painting will happen
+ */
+ return;
+ }
} else {
Display d= fTextWidget.getDisplay();
if (DEBUG && event != null && event.isWorldChange()) {

Back to the top