Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPawel Piech2012-04-09 19:22:02 -0400
committerPawel Piech2012-04-09 19:22:02 -0400
commitc5f4e83dcce152ab653d22968e4c60ddf30896d6 (patch)
treec2bf4d5b2ba483e78f90b458a01b4b69d0fa5396
parent4c1874fbdca333cadccd1271d06796c0ee5fb1c7 (diff)
downloadeclipse.platform.debug-c5f4e83dcce152ab653d22968e4c60ddf30896d6.tar.gz
eclipse.platform.debug-c5f4e83dcce152ab653d22968e4c60ddf30896d6.tar.xz
eclipse.platform.debug-c5f4e83dcce152ab653d22968e4c60ddf30896d6.zip
Bug 304066 - [flex] Race conditions in processing of delta and content updates
Remainder of fix.
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/TestModelUpdatesListener.java2
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/TreeModelContentProvider.java33
2 files changed, 24 insertions, 11 deletions
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/TestModelUpdatesListener.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/TestModelUpdatesListener.java
index 0782d0e1c..c284880a2 100644
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/TestModelUpdatesListener.java
+++ b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/TestModelUpdatesListener.java
@@ -432,7 +432,7 @@ public class TestModelUpdatesListener
public boolean isFinished(int flags) {
if (isTimedOut()) {
- //throw new RuntimeException("Timed Out: " + toString(flags));
+ throw new RuntimeException("Timed Out: " + toString(flags));
}
if (fFailExpectation != null) {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/TreeModelContentProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/TreeModelContentProvider.java
index 20057d563..03ce0a716 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/TreeModelContentProvider.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/TreeModelContentProvider.java
@@ -122,10 +122,12 @@ public class TreeModelContentProvider implements ITreeModelContentProvider, ICon
private List fCompletedUpdates = new ArrayList();
- private Runnable fCompletedUpdatesJob;
+ private Runnable fCompletedUpdatesRunnable;
private ViewerStateTracker fStateTracker = new ViewerStateTracker(this);
-
+
+ private Runnable fTriggerUpdatesRunnable;
+
/**
* Update type constants
*/
@@ -787,12 +789,14 @@ public class TreeModelContentProvider implements ITreeModelContentProvider, ICon
}
}
if (inProgressList == null || inProgressList.isEmpty()) {
- getViewer().getDisplay().asyncExec(new Runnable() {
+ fTriggerUpdatesRunnable = new Runnable() {
public void run() {
+ if (fTriggerUpdatesRunnable != this) return;
if (isDisposed()) return;
trigger(update.getSchedulingPath());
}
- });
+ };
+ getViewer().getDisplay().asyncExec(fTriggerUpdatesRunnable);
}
} else {
// there are waiting requests: coalesce with existing request and add to list
@@ -1595,20 +1599,29 @@ public class TreeModelContentProvider implements ITreeModelContentProvider, ICon
*/
void scheduleViewerUpdate(ViewerUpdateMonitor update) {
Display display;
+ Runnable updateJob = null;
synchronized(this) {
if (isDisposed()) return;
display = getViewer().getDisplay();
fCompletedUpdates.add(update);
- if (fCompletedUpdatesJob == null) {
- fCompletedUpdatesJob = new Runnable() {
+ if (fCompletedUpdatesRunnable == null) {
+ fCompletedUpdatesRunnable = new Runnable() {
public void run() {
if (!isDisposed()) {
performUpdates();
}
}
};
- display.asyncExec(fCompletedUpdatesJob);
- }
+ updateJob = fCompletedUpdatesRunnable;
+ }
+ }
+
+ if (updateJob != null) {
+ if (Thread.currentThread() == display.getThread()) {
+ performUpdates();
+ } else {
+ display.asyncExec(updateJob);
+ }
}
}
@@ -1619,12 +1632,12 @@ public class TreeModelContentProvider implements ITreeModelContentProvider, ICon
Assert.isTrue( getViewer().getDisplay().getThread() == Thread.currentThread() );
List jobCompletedUpdates;
- synchronized(TreeModelContentProvider.this) {
+ synchronized(this) {
if (isDisposed()) {
return;
}
jobCompletedUpdates = fCompletedUpdates;
- fCompletedUpdatesJob = null;
+ fCompletedUpdatesRunnable = null;
fCompletedUpdates = new ArrayList();
}
// necessary to check if viewer is disposed

Back to the top