Skip to content

Commit 8050325

Browse files
committed
UI component being attempted to be disposed in a non-ui thread.
1 parent 88774cd commit 8050325

File tree

3 files changed

+28
-8
lines changed

3 files changed

+28
-8
lines changed

bundles/org.eclipse.ui.navigator.resources/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: %Plugin.name
44
Bundle-SymbolicName: org.eclipse.ui.navigator.resources; singleton:=true
5-
Bundle-Version: 3.9.800.qualifier
5+
Bundle-Version: 3.9.900.qualifier
66
Bundle-Activator: org.eclipse.ui.internal.navigator.resources.plugin.WorkbenchNavigatorPlugin
77
Bundle-Vendor: %Plugin.providerName
88
Bundle-Localization: plugin

bundles/org.eclipse.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/actions/EditActionGroup.java

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2006, 2015 IBM Corporation and others.
2+
* Copyright (c) 2006, 2025 IBM Corporation and others.
33
*
44
* This program and the accompanying materials
55
* are made available under the terms of the Eclipse Public License 2.0
@@ -18,8 +18,10 @@
1818
import org.eclipse.jface.action.IMenuManager;
1919
import org.eclipse.jface.viewers.IStructuredSelection;
2020
import org.eclipse.swt.SWT;
21+
import org.eclipse.swt.SWTException;
2122
import org.eclipse.swt.dnd.Clipboard;
2223
import org.eclipse.swt.events.KeyEvent;
24+
import org.eclipse.swt.widgets.Display;
2325
import org.eclipse.swt.widgets.Shell;
2426
import org.eclipse.ui.IActionBars;
2527
import org.eclipse.ui.ISharedImages;
@@ -55,9 +57,22 @@ public EditActionGroup(Shell aShell) {
5557

5658
@Override
5759
public void dispose() {
58-
if (clipboard != null) {
59-
clipboard.dispose();
60-
clipboard = null;
60+
Display display = Display.getCurrent();
61+
if (display != null && !display.isDisposed()) {
62+
if (clipboard != null && !clipboard.isDisposed()) {
63+
clipboard.dispose();
64+
clipboard = null;
65+
}
66+
} else {
67+
// Non-UI thread or display disposed
68+
if (clipboard != null && !clipboard.isDisposed()) {
69+
try {
70+
clipboard.dispose();
71+
clipboard = null;
72+
} catch (SWTException e) {
73+
// Log a message if required.
74+
}
75+
}
6176
}
6277
super.dispose();
6378
}

bundles/org.eclipse.ui.workbench/eclipseui/org/eclipse/ui/internal/e4/compatibility/CompatibilityPart.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2010, 2016 IBM Corporation and others.
2+
* Copyright (c) 2010, 2025 IBM Corporation and others.
33
*
44
* This program and the accompanying materials
55
* are made available under the terms of the Eclipse Public License 2.0
@@ -32,6 +32,7 @@
3232
import org.eclipse.e4.ui.di.Focus;
3333
import org.eclipse.e4.ui.di.Persist;
3434
import org.eclipse.e4.ui.di.PersistState;
35+
import org.eclipse.e4.ui.di.UISynchronize;
3536
import org.eclipse.e4.ui.internal.workbench.Activator;
3637
import org.eclipse.e4.ui.internal.workbench.Policy;
3738
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
@@ -418,9 +419,13 @@ public void create() {
418419
}
419420

420421
@PreDestroy
421-
void destroy() {
422+
void destroy(UISynchronize sync) {
422423
if (!alreadyDisposed) {
423-
invalidate();
424+
sync.syncExec(() -> {
425+
if (!alreadyDisposed) {
426+
invalidate();
427+
}
428+
});
424429
}
425430

426431
eventBroker.unsubscribe(widgetSetHandler);

0 commit comments

Comments
 (0)