diff options
author | Ghaith Hachem | 2015-12-14 15:50:33 +0000 |
---|---|---|
committer | Sarika Sinha | 2016-01-20 06:15:43 +0000 |
commit | 5fc4fba5a5734ec73a706a9dc21d773756656f3a (patch) | |
tree | a289ad972ae084a634852bc013b6ecf09c5bf3e9 | |
parent | 39b2b602f7bdada3a072ec1a9aeb1253621ee977 (diff) | |
download | eclipse.platform.debug-5fc4fba5a5734ec73a706a9dc21d773756656f3a.tar.gz eclipse.platform.debug-5fc4fba5a5734ec73a706a9dc21d773756656f3a.tar.xz eclipse.platform.debug-5fc4fba5a5734ec73a706a9dc21d773756656f3a.zip |
Bug 484329 - Make ShowConsoleViewJob thread safe
Changed the runInUIThread method of the ShowConsoleViewJob to work with
a local reference to the passed console. This prevents null pointers
when another thread sets the console to null while this job is running.
Change-Id: Ie00f90fb3fb8e9fb48cb543cd7c01da149e371cc
Signed-off-by: ghha <ghaith.hachem@bachmann.info>
-rw-r--r-- | org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleManager.java | 11 |
1 files changed, 6 insertions, 5 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 fbc8a7a50..fe6413ed4 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 @@ -297,7 +297,8 @@ public class ConsoleManager implements IConsoleManager { public IStatus runInUIThread(IProgressMonitor monitor) { boolean consoleFound = false; IWorkbenchWindow window= PlatformUI.getWorkbench().getActiveWorkbenchWindow(); - if (window != null && console != null) { + IConsole c = console; + if (window != null && c != null) { IWorkbenchPage page= window.getActivePage(); if (page != null) { synchronized (fConsoleViews) { @@ -306,11 +307,11 @@ public class ConsoleManager implements IConsoleManager { boolean consoleVisible = page.isPartVisible(consoleView); if (consoleVisible) { consoleFound = true; - boolean bringToTop = shouldBringToTop(console, consoleView); + boolean bringToTop = shouldBringToTop(c, consoleView); if (bringToTop) { page.bringToTop(consoleView); } - consoleView.display(console); + consoleView.display(c); } } } @@ -319,11 +320,11 @@ public class ConsoleManager implements IConsoleManager { if (!consoleFound) { try { IConsoleView consoleView = (IConsoleView) page.showView(IConsoleConstants.ID_CONSOLE_VIEW, null, IWorkbenchPage.VIEW_CREATE); - boolean bringToTop = shouldBringToTop(console, consoleView); + boolean bringToTop = shouldBringToTop(c, consoleView); if (bringToTop) { page.bringToTop(consoleView); } - consoleView.display(console); + consoleView.display(c); } catch (PartInitException pie) { ConsolePlugin.log(pie); } |