diff --git a/bundles/org.eclipse.ui.workbench/eclipseui/org/eclipse/ui/internal/WorkbenchPlugin.java b/bundles/org.eclipse.ui.workbench/eclipseui/org/eclipse/ui/internal/WorkbenchPlugin.java index 17e5ca31874..7ed2f9875f9 100644 --- a/bundles/org.eclipse.ui.workbench/eclipseui/org/eclipse/ui/internal/WorkbenchPlugin.java +++ b/bundles/org.eclipse.ui.workbench/eclipseui/org/eclipse/ui/internal/WorkbenchPlugin.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2018 IBM Corporation and others. + * Copyright (c) 2000, 2025 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -1175,15 +1175,25 @@ public static boolean isSplashHandleSpecified() { */ public static Shell getSplashShell(Display display) throws NumberFormatException, IllegalArgumentException { + if (display == null || display.isDisposed()) { + return null; + } Shell splashShell = (Shell) display.getData(DATA_SPLASH_SHELL); - if (splashShell != null) + if (splashShell != null) { + if (splashShell.isDisposed()) { + return null; + } return splashShell; + } String splashHandle = System.getProperty(PROP_SPLASH_HANDLE); if (splashHandle == null) { return null; } + if (display.isDisposed()) { + return null; + } splashShell = Shell.internal_new(display, Long.parseLong(splashHandle)); display.setData(DATA_SPLASH_SHELL, splashShell); diff --git a/bundles/org.eclipse.ui.workbench/eclipseui/org/eclipse/ui/internal/services/WorkbenchSourceProvider.java b/bundles/org.eclipse.ui.workbench/eclipseui/org/eclipse/ui/internal/services/WorkbenchSourceProvider.java index b37965da3ac..46df1fac10d 100644 --- a/bundles/org.eclipse.ui.workbench/eclipseui/org/eclipse/ui/internal/services/WorkbenchSourceProvider.java +++ b/bundles/org.eclipse.ui.workbench/eclipseui/org/eclipse/ui/internal/services/WorkbenchSourceProvider.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2015 IBM Corporation and others. + * Copyright (c) 2009, 2025 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -403,7 +403,16 @@ private ShowInContext getContext(IWorkbenchPart sourcePart) { } private IWorkbenchWindow getActiveWindow() { - final Shell newActiveShell = workbench.getDisplay().getActiveShell(); + Display display = workbench.getDisplay(); + if (display == null || display.isDisposed()) { + return null; + } + + final Shell newActiveShell = display.getActiveShell(); + if (newActiveShell == null || newActiveShell.isDisposed()) { + return null; + } + final IContextService contextService = workbench.getService(IContextService.class); if (contextService != null) { final int shellType = contextService.getShellType(newActiveShell);