Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDoug Schaefer2014-10-21 14:45:18 +0000
committerDoug Schaefer2014-10-21 16:17:06 +0000
commit99bab2981325bb9155875fa7b555b7cd2b2b52fd (patch)
tree7cfca92e843960ae3a4e03635d93a39439f9668d
parent572b3e917f9e6ac60a811fd9d04452e6f01aa9d6 (diff)
downloadorg.eclipse.cdt-99bab2981325bb9155875fa7b555b7cd2b2b52fd.tar.gz
org.eclipse.cdt-99bab2981325bb9155875fa7b555b7cd2b2b52fd.tar.xz
org.eclipse.cdt-99bab2981325bb9155875fa7b555b7cd2b2b52fd.zip
Bug: 448093 Move the initialization of the launch bar manager to job
We've seen a deadlock during startup mainly caused by CDT but triggered when the launch bar manager initialized. This moves the init to a job where it should be anyway to ensure smooth startup. Change-Id: Id4b63e07dca3f96c561d6b4f45d60cf7cbcf530c Reviewed-on: https://git.eclipse.org/r/35235 Tested-by: Hudson CI Reviewed-by: Doug Schaefer <dschaefer@qnx.com>
-rw-r--r--launch/org.eclipse.cdt.launchbar.core.tests/src/org/eclipse/cdt/launchbar/core/internal/LaunchBarManagerTest.java20
-rw-r--r--launch/org.eclipse.cdt.launchbar.core/src/org/eclipse/cdt/launchbar/core/internal/LaunchBarManager.java20
2 files changed, 39 insertions, 1 deletions
diff --git a/launch/org.eclipse.cdt.launchbar.core.tests/src/org/eclipse/cdt/launchbar/core/internal/LaunchBarManagerTest.java b/launch/org.eclipse.cdt.launchbar.core.tests/src/org/eclipse/cdt/launchbar/core/internal/LaunchBarManagerTest.java
index 1aa0f9024e7..e62b33142a3 100644
--- a/launch/org.eclipse.cdt.launchbar.core.tests/src/org/eclipse/cdt/launchbar/core/internal/LaunchBarManagerTest.java
+++ b/launch/org.eclipse.cdt.launchbar.core.tests/src/org/eclipse/cdt/launchbar/core/internal/LaunchBarManagerTest.java
@@ -62,12 +62,32 @@ public class LaunchBarManagerTest extends TestCase {
public class TestLaunchBarManager extends LaunchBarManager {
private ILaunchMode[] defaultLaunchModes;
+ boolean done;
public TestLaunchBarManager() throws CoreException {
super();
+ // For the tests, need to wait until the init is done
+ synchronized (this) {
+ while (!done) {
+ try {
+ wait();
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ }
}
@Override
+ public void init() throws CoreException {
+ super.init();
+ synchronized (this) {
+ done = true;
+ notify();
+ }
+ }
+
+ @Override
public IExtensionPoint getExtensionPoint() throws CoreException {
// default things
IExtensionPoint point = mock(IExtensionPoint.class);
diff --git a/launch/org.eclipse.cdt.launchbar.core/src/org/eclipse/cdt/launchbar/core/internal/LaunchBarManager.java b/launch/org.eclipse.cdt.launchbar.core/src/org/eclipse/cdt/launchbar/core/internal/LaunchBarManager.java
index 18201f7ca8c..8afe127916d 100644
--- a/launch/org.eclipse.cdt.launchbar.core/src/org/eclipse/cdt/launchbar/core/internal/LaunchBarManager.java
+++ b/launch/org.eclipse.cdt.launchbar.core/src/org/eclipse/cdt/launchbar/core/internal/LaunchBarManager.java
@@ -33,9 +33,13 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtension;
import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.ISafeRunnable;
+import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.SafeRunner;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.debug.core.DebugPlugin;
@@ -227,7 +231,21 @@ public class LaunchBarManager implements ILaunchBarManager, ILaunchConfiguration
private static final String PREF_ACTIVE_LAUNCH_TARGET = "activeLaunchTarget";
private static final String PREF_CONFIG_DESC_ORDER = "configDescList";
- public LaunchBarManager() throws CoreException {
+ public LaunchBarManager() {
+ new Job("Launch Bar Initialization") {
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ try {
+ init();
+ return Status.OK_STATUS;
+ } catch (CoreException e) {
+ return e.getStatus();
+ }
+ }
+ }.schedule();
+ }
+
+ public void init() throws CoreException {
// Fetch the desc order before the init messes it up
IEclipsePreferences store = getPreferenceStore();
String configDescIds = store.get(PREF_CONFIG_DESC_ORDER, "");

Back to the top