Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Sawicki2012-06-01 00:39:24 +0000
committerMatthias Sohn2012-06-04 14:48:50 +0000
commitd3a6b1e63166b1a7036c2f268ed5644183ec9959 (patch)
treee4ddc46ff0789cd7bd7a8eb52c1604a33919c243
parentbc785070f9bd4f3e991c05fbdc2963c819e17238 (diff)
downloadegit-d3a6b1e63166b1a7036c2f268ed5644183ec9959.tar.gz
egit-d3a6b1e63166b1a7036c2f268ed5644183ec9959.tar.xz
egit-d3a6b1e63166b1a7036c2f268ed5644183ec9959.zip
[historyView] Perform clear on background thread when disposed
An NPE can occur if SWTCommitList.clear() is called from dispose() while fillTo() is running from GenerateHistoryJob. dispose() is always called on the UI-thread so schedule a background thread that synchronizes on the instance and calls clear since all other state accessing calls to the SWTCommitList instance are done inside synchronized blocks. Change-Id: I855d5bfeb5131c634b4790e6b7231424f2be4566
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/SWTCommitList.java18
1 files changed, 17 insertions, 1 deletions
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/SWTCommitList.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/SWTCommitList.java
index 6a84ea5598..36603dd530 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/SWTCommitList.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/SWTCommitList.java
@@ -11,6 +11,10 @@ package org.eclipse.egit.ui.internal.history;
import java.util.ArrayList;
import java.util.LinkedList;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jgit.revplot.PlotCommitList;
import org.eclipse.jgit.revplot.PlotLane;
import org.eclipse.swt.events.DisposeEvent;
@@ -53,7 +57,19 @@ class SWTCommitList extends PlotCommitList<SWTCommitList.SWTLane> implements Dis
}
public void dispose() {
- clear();
+ Job clearJob = new Job("Clearing commit list") { //$NON-NLS-1$
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ synchronized (SWTCommitList.this) {
+ clear();
+ }
+ return Status.OK_STATUS;
+ }
+ };
+ clearJob.setSystem(true);
+ clearJob.schedule();
+
for (Color color : allColors)
color.dispose();
if (!control.isDisposed())

Back to the top