1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-11 02:05:39 +02:00

[275136] [view model] done() may be called twice on request monitor

This commit is contained in:
Anton Leherbauer 2009-05-06 15:10:23 +00:00
parent 1054b43f5b
commit 2964162173
2 changed files with 12 additions and 11 deletions

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2007, 2008 Wind River Systems and others.
* Copyright (c) 2007, 2009 Wind River Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -272,14 +272,11 @@ public class DefaultVMContentProviderStrategy implements IElementContentProvider
childNodes[i],
new VMChildrenCountUpdate(update, childrenCountMultiReqMon.add(new ViewerDataRequestMonitor<Integer>(
getVMProvider().getExecutor(), update) {
@Override
protected void handleSuccess() {
counts[nodeIndex] = getData();
}
@Override
protected void handleCompleted() {
super.handleCompleted();
if (isSuccess()) {
counts[nodeIndex] = getData();
}
childrenCountMultiReqMon.requestMonitorDone(this);
}
})));

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2008 Wind River Systems, Inc. and others.
* Copyright (c) 2008, 2009 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -123,6 +123,7 @@ class MultiLevelUpdateHandler extends DataRequestMonitor<List<Object>> {
private int fLowIndex = 0;
private int fHighIndex = Integer.MAX_VALUE - 1;
private int fPendingUpdates;
private boolean fIsDone;
public MultiLevelUpdateHandler(Executor executor,
IVMModelProxy modelProxy,
@ -150,11 +151,13 @@ class MultiLevelUpdateHandler extends DataRequestMonitor<List<Object>> {
fLowIndex = low;
fHighIndex = high;
}
boolean isDone() {
return fStack.isEmpty();
}
@Override
public synchronized void done() {
assert !fIsDone;
if (fIsDone) {
// ignore gracefully
return;
}
try {
fExecutor.execute(new DsfRunnable() {
public void run() {
@ -180,6 +183,7 @@ class MultiLevelUpdateHandler extends DataRequestMonitor<List<Object>> {
fStack.clear();
}
if (fStack.isEmpty()) {
fIsDone = true;
fRequestMonitor.setDoneCount(fPendingUpdates);
super.done();
return;