diff options
author | Paul Pazderski | 2019-04-23 18:09:20 +0000 |
---|---|---|
committer | Paul | 2019-04-24 18:11:47 +0000 |
commit | f0cc33023dda08a2bae26b32c8e22a2863729724 (patch) | |
tree | fefb931ac83d12b847919f24db0af0142d740ddd | |
parent | e464979869b087a1af7c21fa4b54136db563bda4 (diff) | |
download | eclipse.platform.debug-f0cc33023dda08a2bae26b32c8e22a2863729724.tar.gz eclipse.platform.debug-f0cc33023dda08a2bae26b32c8e22a2863729724.tar.xz eclipse.platform.debug-f0cc33023dda08a2bae26b32c8e22a2863729724.zip |
Bug 546710 - [console] Race condition in ProcessConsole init with fast
terminating processes
Monitoring of process termination and console initialization are
performed in separate threads. The ProcessConsole can miss the
termination between the termination check in init and the following
listener registration.
Change-Id: If66027d87a7ef0cc19869d568d209c9387d5a606
Signed-off-by: Paul Pazderski <paul-eclipse@ppazderski.de>
-rw-r--r-- | org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsole.java | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsole.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsole.java index 085cb0f80..6659ef202 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsole.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsole.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2018 IBM Corporation and others. + * Copyright (c) 2000, 2019 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -439,11 +439,11 @@ public class ProcessConsole extends IOConsole implements IConsole, IDebugEventSe @Override protected void init() { super.init(); + DebugPlugin.getDefault().addDebugEventListener(this); if (fProcess.isTerminated()) { closeStreams(); resetName(); - } else { - DebugPlugin.getDefault().addDebugEventListener(this); + DebugPlugin.getDefault().removeDebugEventListener(this); } IPreferenceStore store = DebugUIPlugin.getDefault().getPreferenceStore(); store.addPropertyChangeListener(this); @@ -489,7 +489,7 @@ public class ProcessConsole extends IOConsole implements IConsole, IDebugEventSe /** * resets the name of this console to the original computed name */ - private void resetName() { + private synchronized void resetName() { final String newName = computeName(); String name = getName(); if (!name.equals(newName)) { |