1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-07 01:36:01 +02:00

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>
This commit is contained in:
Doug Schaefer 2014-10-21 10:45:18 -04:00
parent 572b3e917f
commit 99bab29813
2 changed files with 39 additions and 1 deletions

View file

@ -62,9 +62,29 @@ public class LaunchBarManagerTest extends TestCase {
public class TestLaunchBarManager extends LaunchBarManager { public class TestLaunchBarManager extends LaunchBarManager {
private ILaunchMode[] defaultLaunchModes; private ILaunchMode[] defaultLaunchModes;
boolean done;
public TestLaunchBarManager() throws CoreException { public TestLaunchBarManager() throws CoreException {
super(); 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 @Override

View file

@ -33,9 +33,13 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement; import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtension; import org.eclipse.core.runtime.IExtension;
import org.eclipse.core.runtime.IExtensionPoint; import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.ISafeRunnable; import org.eclipse.core.runtime.ISafeRunnable;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.SafeRunner; 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.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.InstanceScope; import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.debug.core.DebugPlugin; 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_ACTIVE_LAUNCH_TARGET = "activeLaunchTarget";
private static final String PREF_CONFIG_DESC_ORDER = "configDescList"; 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 // Fetch the desc order before the init messes it up
IEclipsePreferences store = getPreferenceStore(); IEclipsePreferences store = getPreferenceStore();
String configDescIds = store.get(PREF_CONFIG_DESC_ORDER, ""); String configDescIds = store.get(PREF_CONFIG_DESC_ORDER, "");