From 2964162173de6880b5afa2f5c13247d601e4404d Mon Sep 17 00:00:00 2001 From: Anton Leherbauer Date: Wed, 6 May 2009 15:10:23 +0000 Subject: [PATCH] [275136] [view model] done() may be called twice on request monitor --- .../viewmodel/DefaultVMContentProviderStrategy.java | 11 ++++------- .../ui/viewmodel/update/MultiLevelUpdateHandler.java | 12 ++++++++---- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/ui/viewmodel/DefaultVMContentProviderStrategy.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/ui/viewmodel/DefaultVMContentProviderStrategy.java index 02a97da2c46..c5f0ccf12df 100644 --- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/ui/viewmodel/DefaultVMContentProviderStrategy.java +++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/ui/viewmodel/DefaultVMContentProviderStrategy.java @@ -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( getVMProvider().getExecutor(), update) { - @Override - protected void handleSuccess() { - counts[nodeIndex] = getData(); - } - @Override protected void handleCompleted() { - super.handleCompleted(); + if (isSuccess()) { + counts[nodeIndex] = getData(); + } childrenCountMultiReqMon.requestMonitorDone(this); } }))); diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/ui/viewmodel/update/MultiLevelUpdateHandler.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/ui/viewmodel/update/MultiLevelUpdateHandler.java index 9d97d07ad42..4949608edf7 100644 --- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/ui/viewmodel/update/MultiLevelUpdateHandler.java +++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/ui/viewmodel/update/MultiLevelUpdateHandler.java @@ -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> { 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> { 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> { fStack.clear(); } if (fStack.isEmpty()) { + fIsDone = true; fRequestMonitor.setDoneCount(fPendingUpdates); super.done(); return;