From ea18f6f726b5e0046747253ef1e02e236c27e8f2 Mon Sep 17 00:00:00 2001 From: Marc Khouzam Date: Fri, 30 Apr 2010 17:07:00 +0000 Subject: [PATCH] Bug 309309: CommandCache could prevent RMs from being completed if the ICommandControl.queueCommand() returned right away. --- .../debug/service/command/CommandCache.java | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/debug/service/command/CommandCache.java b/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/debug/service/command/CommandCache.java index 08bd677026a..20851ae8086 100644 --- a/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/debug/service/command/CommandCache.java +++ b/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/debug/service/command/CommandCache.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2008 Wind River Systems and others. + * Copyright (c) 2007, 2010 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 @@ -418,13 +418,17 @@ public class CommandCache implements ICommandListener * Match this up with a command set we know about. */ if ( ! fPendingQCommandsSent.remove(finalCachedCmd) ) { - /* - * It should not be the case that this is possible. It would mean we - * have mismanaged the queues or completions are lost at the lower - * levels. When the removal and cancellation is completed this code - * will probably not be here. But for now just return. - */ - return ; + /* + * This can happen if the call to queueCommand() completes without + * actually having to send the command. In that case, we should find + * our command in the fPendingQCommandsNotYetSent queue. + * For example, upon termination some queueCommand() implementation + * may complete immediately with an error status. Bug 309309 + */ + if ( ! fPendingQCommandsNotYetSent.remove(finalCachedCmd) ) { + assert false : "Missing command"; //$NON-NLS-1$ + return; + } } ICommandResult result = getData();