Skip to content

Commit

Permalink
Regression - deadlock on undo (eclipse-platform#15)
Browse files Browse the repository at this point in the history
Reverted commit d610ff2 as it caused
deadlock during undo if the undo operation also wants to use workspace
rule.

This fixes issue
eclipse-platform#15
  • Loading branch information
iloveeclipse committed Apr 19, 2022
1 parent d610ff2 commit 7c144e6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,15 @@
import org.eclipse.core.commands.operations.IUndoContext;
import org.eclipse.core.commands.operations.IUndoableOperation;
import org.eclipse.core.commands.operations.OperationHistoryEvent;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.Adapters;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.jobs.IJobManager;
import org.eclipse.core.runtime.jobs.ISchedulingRule;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.LegacyActionTools;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.custom.BusyIndicator;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IPartListener;
Expand Down Expand Up @@ -303,27 +298,7 @@ public final void run() {
if (getOperation() instanceof IAdvancedUndoableOperation2) {
runInBackground = ((IAdvancedUndoableOperation2) getOperation()).runInBackground();
}
if (runInBackground) {
progressDialog.run(runInBackground, true, runnable);
} else {
// prevent UI freeze during AutoBuild as in
// org.eclipse.jdt.internal.ui.refactoring.RefactoringExecutionHelper#perform
final IJobManager manager = Job.getJobManager();
// pessimistic scheduling rule:
final ISchedulingRule rule = ResourcesPlugin.getWorkspace().getRoot();
try {
try {
// interrupt autobuild or show Wait/Cancel Dialog:
Runnable r = () -> manager.beginRule(rule, null);
BusyIndicator.showWhile(parent.getDisplay(), r);
} catch (OperationCanceledException e) {
throw new InterruptedException(e.getMessage());
}
progressDialog.run(runInBackground, true, runnable); // <-- actual work
} finally {
manager.endRule(rule);
}
}
progressDialog.run(runInBackground, true, runnable);
} catch (InvocationTargetException e) {
Throwable t = e.getTargetException();
if (t == null) {
Expand Down
3 changes: 1 addition & 2 deletions bundles/org.eclipse.ui.workbench/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,7 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.19.0,4.0.0)",
org.eclipse.emf.ecore;bundle-version="2.7.0",
org.eclipse.e4.ui.services;bundle-version="1.3.0",
org.eclipse.emf.ecore.xmi;bundle-version="2.11.0",
org.eclipse.e4.core.di.extensions;bundle-version="0.13.0",
org.eclipse.core.resources;bundle-version="3.17.0"
org.eclipse.e4.core.di.extensions;bundle-version="0.13.0"
Import-Package: com.ibm.icu.util,
javax.annotation,
javax.inject;version="1.0.0",
Expand Down

0 comments on commit 7c144e6

Please sign in to comment.