Skip to content

Commit 6a67e13

Browse files
authored
IEP-1746 Fix IllegalStateException in ActiveLaunchConfigurationProvider when JobManager is suspended (#1432)
* fix: remove ActiveLaunchConfigurationProvider to fix crash * fix: removed ActiveLaunchConfProvider from executor
1 parent 4dc4fd6 commit 6a67e13

5 files changed

Lines changed: 29 additions & 160 deletions

File tree

bundles/com.espressif.idf.core/META-INF/MANIFEST.MF

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ Bundle-ClassPath: .,
6363
lib/commons-compress-1.21.jar,
6464
lib/xz-1.9.jar
6565
Import-Package: org.apache.commons.logging,
66+
org.eclipse.cdt.debug.core,
6667
org.eclipse.cdt.debug.core.launch,
6768
org.eclipse.embedcdt.core,
6869
org.eclipse.ui.console

bundles/com.espressif.idf.core/src/com/espressif/idf/core/build/ActiveLaunchConfigurationProvider.java

Lines changed: 0 additions & 66 deletions
This file was deleted.

bundles/com.espressif.idf.core/src/com/espressif/idf/core/build/IDFBuildConfiguration.java

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@
9393
public class IDFBuildConfiguration extends CBuildConfiguration
9494
{
9595

96-
private static final ActiveLaunchConfigurationProvider LAUNCH_CONFIG_PROVIDER = new ActiveLaunchConfigurationProvider();
9796
private static final String NINJA = "Ninja"; //$NON-NLS-1$
9897
protected static final String COMPILE_COMMANDS_JSON = "compile_commands.json"; //$NON-NLS-1$
9998
protected static final String COMPONENTS = "components"; //$NON-NLS-1$
@@ -190,16 +189,29 @@ public String getProperty(String name)
190189
{
191190
try
192191
{
193-
ILaunchConfiguration configuration = LAUNCH_CONFIG_PROVIDER.getActiveLaunchConfiguration();
194-
if (configuration != null
195-
&& configuration.getType().getIdentifier().equals(IDFLaunchConstants.DEBUG_LAUNCH_CONFIG_TYPE))
192+
ILaunchBarManager launchBarManager = IDFCorePlugin.getService(ILaunchBarManager.class);
193+
ILaunchConfiguration configuration = null;
194+
195+
if (launchBarManager != null)
196+
{
197+
configuration = launchBarManager.getActiveLaunchConfiguration();
198+
}
199+
200+
if (configuration == null)
201+
{
202+
Logger.log("Warning: Launch Bar not ready. Falling back to default properties for " + name); //$NON-NLS-1$
203+
return super.getProperty(name);
204+
}
205+
206+
if (configuration.getType().getIdentifier().equals(IDFLaunchConstants.DEBUG_LAUNCH_CONFIG_TYPE))
196207
{
197208
configuration = new LaunchUtil(DebugPlugin.getDefault().getLaunchManager())
198209
.getBoundConfiguration(configuration);
199210
}
200-
String property = configuration == null ? StringUtil.EMPTY
201-
: configuration.getAttribute(name, StringUtil.EMPTY);
211+
212+
String property = configuration.getAttribute(name, StringUtil.EMPTY);
202213
property = property.isBlank() ? getSettings().get(name, StringUtil.EMPTY) : property;
214+
203215
return property;
204216
}
205217
catch (CoreException e)

bundles/com.espressif.idf.core/src/com/espressif/idf/core/util/IdfCommandExecutor.java

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@
2121
import org.eclipse.debug.core.DebugPlugin;
2222
import org.eclipse.debug.core.ILaunchConfiguration;
2323
import org.eclipse.debug.core.ILaunchManager;
24+
import org.eclipse.launchbar.core.ILaunchBarManager;
2425
import org.eclipse.ui.console.MessageConsole;
2526
import org.eclipse.ui.console.MessageConsoleStream;
2627

2728
import com.espressif.idf.core.IDFCorePlugin;
2829
import com.espressif.idf.core.IDFEnvironmentVariables;
2930
import com.espressif.idf.core.ProcessBuilderFactory;
30-
import com.espressif.idf.core.build.ActiveLaunchConfigurationProvider;
3131
import com.espressif.idf.core.build.IDFLaunchConstants;
3232
import com.espressif.idf.core.logging.Logger;
3333

@@ -36,8 +36,7 @@ public class IdfCommandExecutor
3636

3737
private final String target;
3838
private final MessageConsole console;
39-
private static final String CMAKE_ARGUMENTS = "cmake.arguments"; //$NON-NLS-1$
40-
private static final ActiveLaunchConfigurationProvider LAUNCH_CONFIG_PROVIDER = new ActiveLaunchConfigurationProvider();
39+
4140

4241
public IdfCommandExecutor(String target, MessageConsole console)
4342
{
@@ -100,7 +99,14 @@ public String getProperty(String name)
10099
{
101100
try
102101
{
103-
ILaunchConfiguration configuration = LAUNCH_CONFIG_PROVIDER.getActiveLaunchConfiguration();
102+
ILaunchBarManager launchBarManager = IDFCorePlugin.getService(ILaunchBarManager.class);
103+
ILaunchConfiguration configuration = null;
104+
105+
if (launchBarManager != null)
106+
{
107+
configuration = launchBarManager.getActiveLaunchConfiguration();
108+
}
109+
104110
if (configuration != null
105111
&& configuration.getType().getIdentifier().equals(IDFLaunchConstants.DEBUG_LAUNCH_CONFIG_TYPE))
106112
{

tests/com.espressif.idf.core.test/src/com/espressif/idf/core/test/ActiveLaunchConfigurationTest.java

Lines changed: 0 additions & 84 deletions
This file was deleted.

0 commit comments

Comments
 (0)