Skip to content

Commit 6160483

Browse files
fix(launching): run DebugUITools.launch in UI thread
MavenConsoleLineTracker.launchRemoteJavaApp was called from a ConsolePatternMatcher worker thread, so DebugUITools.launch hit Display.getShells() off the SWT UI thread and threw SWTException: Invalid thread access. Wrap the launch in Display.asyncExec so it runs on the UI thread. Fixes #2218 Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
1 parent 02002ee commit 6160483

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

org.eclipse.m2e.launching/META-INF/MANIFEST.MF

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
22
Bundle-ManifestVersion: 2
33
Bundle-Name: %Bundle-Name
44
Bundle-SymbolicName: org.eclipse.m2e.launching;singleton:=true
5-
Bundle-Version: 2.1.200.qualifier
5+
Bundle-Version: 2.1.300.qualifier
66
Bundle-Localization: plugin
77
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.27.0,4.0.0)",
88
org.eclipse.core.variables,

org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenConsoleLineTracker.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
5959
import org.eclipse.jface.text.BadLocationException;
6060
import org.eclipse.jface.text.IRegion;
61+
import org.eclipse.swt.widgets.Display;
6162
import org.eclipse.ui.IWorkbenchPage;
6263
import org.eclipse.ui.PlatformUI;
6364
import org.eclipse.ui.console.IHyperlink;
@@ -329,7 +330,7 @@ private static void launchRemoteJavaApp(IProject project, String portString) thr
329330
workingCopy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, project.getName());
330331
}
331332

332-
DebugUITools.launch(workingCopy, ILaunchManager.DEBUG_MODE); //$NON-NLS-1$
333+
Display.getDefault().asyncExec(() -> DebugUITools.launch(workingCopy, ILaunchManager.DEBUG_MODE)); //$NON-NLS-1$
333334
}
334335

335336
/**

0 commit comments

Comments
 (0)