Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CMake] Launch Bar, Launch Configuration gear button fails to open Edit Launch Configuration dialog when no toolchain installed #932

Open
betamaxbandit opened this issue Nov 3, 2024 · 1 comment

Comments

@betamaxbandit
Copy link
Contributor

betamaxbandit commented Nov 3, 2024

The Edit Launch Configuration dialog, opened by clicking the Launch Bar, Launch Configuration gear button, fails without giving any error message, when there is no GCC toolchain installed on the host, that is recognised by the Core Build Toolchain Manager.
This is caused by an NPE:

!ENTRY org.eclipse.ui 4 0 2024-11-01 14:53:38.727!MESSAGE Unhandled event loop exception
!STACK 0
java.lang.NullPointerException: Cannot invoke "org.eclipse.cdt.core.build.ICBuildConfiguration.getProperty(String)" because "buildConfig" is null
	at org.eclipse.cdt.cmake.ui.internal.CMakeBuildTab.initializeFrom(CMakeBuildTab.java:157)
	at org.eclipse.cdt.launch.ui.corebuild.CoreBuildTab.initializeFrom(CoreBuildTab.java:86)
	at org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup.initializeFrom(AbstractLaunchConfigurationTabGroup.java:93)
	at org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationTabGroupWrapper.initializeFrom(LaunchConfigurationTabGroupWrapper.java:182)
	at org.eclipse.launchbar.ui.internal.LaunchBarLaunchConfigDialog.createDialogArea(LaunchBarLaunchConfigDialog.java:194)
	at org.eclipse.jface.dialogs.TitleAreaDialog.createContents(TitleAreaDialog.java:166)
	at org.eclipse.jface.window.Window.create(Window.java:431)
	at org.eclipse.jface.dialogs.Dialog.create(Dialog.java:1092)
	at org.eclipse.jface.window.Window.open(Window.java:788)
	at org.eclipse.launchbar.ui.internal.LaunchBarUIManager.openConfigurationEditor(LaunchBarUIManager.java:134)
	at org.eclipse.launchbar.ui.controls.internal.ConfigSelector.handleEdit(ConfigSelector.java:156)
	at org.eclipse.launchbar.ui.controls.internal.CSelector$5.lambda$0(CSelector.java:265)
	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:40)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:132)
	at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4141)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3757)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1151)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:339)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1042)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:153)
	at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:639)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:339)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:546)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:173)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:178)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:208)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:143)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:109)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:439)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:271)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:668)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:605)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1481)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1454)

To Reproduce
Steps to reproduce the behavior:

  1. Launch Eclipse CDT on a clean host, that does not contain any toolchains.
  2. Create a CMake Hello World project.
  3. Make sure the Launch Bar is displayed and the Launch Target is set to Local.
  4. In the Launch Bar, click the Launch Configuration gear button.
    Expected: the Edit Launch Configuration dialog appears.
    Actual: the Edit Launch Configuration dialog does not appear. NPE shown is Error view.

Version Information (please complete the following information):

  • Windows 10, probably happens on Linux too.
  • Eclipse SDK Version: 2024-12 (4.34), CDT 11.6.1

Analysis
Logic in org.eclipse.cdt.cmake.ui.internal.CMakeBuildTab.initializeFrom(ILaunchConfiguration) lacks null pointer protection for "buildConfig". The getBuildConfiguration() returns null because an ICBuildConfiguration cannot be generated because of the lack of toolchain.

Solution
Add null pointer protection and add an error message to the Launch Configuration message area.

A patch to fix this will be submitted.

@jonahgraham
Copy link
Member

A patch to fix this will be submitted.

Thanks @betamaxbandit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants