Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarin Wright2010-03-24 18:36:15 +0000
committerDarin Wright2010-03-24 18:36:15 +0000
commit528d5bed95fe7d32c0026e08d6a56fdc8fbb5f2e (patch)
tree8e91c980f03e5500eaf9b994226a2f42744dc8dc /org.eclipse.ui.console
parentc15d4aa81f6123994071139b0cec34be01c5ce50 (diff)
downloadeclipse.platform.debug-528d5bed95fe7d32c0026e08d6a56fdc8fbb5f2e.tar.gz
eclipse.platform.debug-528d5bed95fe7d32c0026e08d6a56fdc8fbb5f2e.tar.xz
eclipse.platform.debug-528d5bed95fe7d32c0026e08d6a56fdc8fbb5f2e.zip
Bug 306914 - Possible deadlock when big chunk of data is written by the process
Diffstat (limited to 'org.eclipse.ui.console')
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleManager.java44
1 files changed, 25 insertions, 19 deletions
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleManager.java b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleManager.java
index df883e24a..b036c00f6 100644
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleManager.java
+++ b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleManager.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * Copyright (c) 2000, 2010 IBM Corporation 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
@@ -211,18 +211,20 @@ public class ConsoleManager implements IConsoleManager {
/* (non-Javadoc)
* @see org.eclipse.ui.console.IConsoleManager#addConsoles(org.eclipse.ui.console.IConsole[])
*/
- public synchronized void addConsoles(IConsole[] consoles) {
+ public void addConsoles(IConsole[] consoles) {
List added = new ArrayList(consoles.length);
- for (int i = 0; i < consoles.length; i++) {
- IConsole console = consoles[i];
- if(console instanceof TextConsole) {
- TextConsole ioconsole = (TextConsole)console;
- createPatternMatchListeners(ioconsole);
- }
- if (!fConsoles.contains(console)) {
- fConsoles.add(console);
- added.add(console);
- }
+ synchronized (fConsoles) {
+ for (int i = 0; i < consoles.length; i++) {
+ IConsole console = consoles[i];
+ if(console instanceof TextConsole) {
+ TextConsole ioconsole = (TextConsole)console;
+ createPatternMatchListeners(ioconsole);
+ }
+ if (!fConsoles.contains(console)) {
+ fConsoles.add(console);
+ added.add(console);
+ }
+ }
}
if (!added.isEmpty()) {
fireUpdate((IConsole[])added.toArray(new IConsole[added.size()]), ADDED);
@@ -232,12 +234,14 @@ public class ConsoleManager implements IConsoleManager {
/* (non-Javadoc)
* @see org.eclipse.ui.console.IConsoleManager#removeConsoles(org.eclipse.ui.console.IConsole[])
*/
- public synchronized void removeConsoles(IConsole[] consoles) {
+ public void removeConsoles(IConsole[] consoles) {
List removed = new ArrayList(consoles.length);
- for (int i = 0; i < consoles.length; i++) {
- IConsole console = consoles[i];
- if (fConsoles.remove(console)) {
- removed.add(console);
+ synchronized (fConsoles) {
+ for (int i = 0; i < consoles.length; i++) {
+ IConsole console = consoles[i];
+ if (fConsoles.remove(console)) {
+ removed.add(console);
+ }
}
}
if (!removed.isEmpty()) {
@@ -248,8 +252,10 @@ public class ConsoleManager implements IConsoleManager {
/* (non-Javadoc)
* @see org.eclipse.ui.console.IConsoleManager#getConsoles()
*/
- public synchronized IConsole[] getConsoles() {
- return (IConsole[])fConsoles.toArray(new IConsole[fConsoles.size()]);
+ public IConsole[] getConsoles() {
+ synchronized (fConsoles) {
+ return (IConsole[])fConsoles.toArray(new IConsole[fConsoles.size()]);
+ }
}
/**

Back to the top