Skip to content

Commit c5a5116

Browse files
committed
Capture long-operation time before workbench shutdown
Avoid calling PlatformUI.getWorkbench() from disconnectFromWorkspace(), which runs from postShutdown() and may execute (via the workspace-locked timerExec retry) after the workbench has been torn down. The display is fetched via Display.getCurrent(), matching the existing pattern in postShutdown(), and the long-operation time is captured in initialize().
1 parent 1341a35 commit c5a5116

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

bundles/org.eclipse.ui.ide.application/src/org/eclipse/ui/internal/ide/application/IDEWorkbenchAdvisor.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,13 @@ public class IDEWorkbenchAdvisor extends WorkbenchAdvisor {
153153
*/
154154
private final int workspaceWaitDelay;
155155

156+
/**
157+
* Captured during {@link #initialize(IWorkbenchConfigurer)} so
158+
* {@link #disconnectFromWorkspace()} does not have to reach through
159+
* {@link PlatformUI#getWorkbench()} after the workbench has been shut down.
160+
*/
161+
private int savedLongOperationTime;
162+
156163
private final Listener closeListener = event -> {
157164
boolean doExit = IDEWorkbenchWindowAdvisor.promptOnExit(null);
158165
event.doit = doExit;
@@ -191,6 +198,8 @@ public IDEWorkbenchAdvisor(DelayedEventsProcessor processor) {
191198
@Override
192199
public void initialize(IWorkbenchConfigurer configurer) {
193200

201+
savedLongOperationTime = configurer.getWorkbench().getProgressService().getLongOperationTime();
202+
194203
PluginActionBuilder.setAllowIdeLogging(true);
195204

196205
initResourceTracking();
@@ -487,8 +496,8 @@ protected void disconnectFromWorkspace() {
487496
}
488497
};
489498

490-
final Display display = PlatformUI.getWorkbench().getDisplay();
491-
final int longOperationTime = PlatformUI.getWorkbench().getProgressService().getLongOperationTime();
499+
final Display display = Display.getCurrent();
500+
final int longOperationTime = savedLongOperationTime;
492501
final Runnable openDialog = () -> {
493502
if (ProgressManagerUtil.safeToOpen(dialog, null)) {
494503
dialog.open();

0 commit comments

Comments
 (0)