Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPawel Piech2012-04-09 23:22:02 +0000
committerPawel Piech2012-04-09 23:22:02 +0000
commitc5f4e83dcce152ab653d22968e4c60ddf30896d6 (patch)
treec2bf4d5b2ba483e78f90b458a01b4b69d0fa5396 /org.eclipse.debug.ui/ui/org/eclipse
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.
Diffstat (limited to 'org.eclipse.debug.ui/ui/org/eclipse')
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/TreeModelContentProvider.java33
1 files changed, 23 insertions, 10 deletions
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