aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBernd Hufmann2012-11-20 11:47:09 (EST)
committerBernd Hufmann2012-11-20 12:51:46 (EST)
commit612266c952e33c9f9608fe9240180e000c048c86 (patch)
treeee378a456a6c5a63df12ca94576b49e5cf6daecd
parentba709e45fc57a37ff99c008de2f582d781035c1a (diff)
downloadorg.eclipse.linuxtools-612266c952e33c9f9608fe9240180e000c048c86.zip
org.eclipse.linuxtools-612266c952e33c9f9608fe9240180e000c048c86.tar.gz
org.eclipse.linuxtools-612266c952e33c9f9608fe9240180e000c048c86.tar.bz2
Fix NPEs in Sequence Diagram Framework during shutdownrefs/changes/81/8781/2
Multiple instances of NPEs: - TmfUml2SDSyncLoader - LoaderManager - SDView Change-Id: Iaea3f46b60527cd84dd8f51bd79319c27925ecce Reviewed-on: https://git.eclipse.org/r/8781 Reviewed-by: Patrick Tasse <patrick.tasse@gmail.com> IP-Clean: Patrick Tasse <patrick.tasse@gmail.com> Tested-by: Hudson CI
-rw-r--r--[-rwxr-xr-x]lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/SDView.java5
-rw-r--r--[-rwxr-xr-x]lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/load/LoadersManager.java17
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/loader/TmfUml2SDSyncLoader.java12
3 files changed, 31 insertions, 3 deletions
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/SDView.java b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/SDView.java
index 721abdc..5c16712 100755..100644
--- a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/SDView.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/SDView.java
@@ -764,8 +764,11 @@ public class SDView extends ViewPart {
}
IUml2SDLoader loader = LoadersManager.getInstance().getCurrentLoader(getViewSite().getId(), this);
+ if (loader == null) {
+ return;
+ }
- if ((loader != null) && (loader.getTitleString() != null)) {
+ if (loader.getTitleString() != null) {
setContentDescription(loader.getTitleString());
}
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/load/LoadersManager.java b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/load/LoadersManager.java
index 447a9c8..97d0474 100755..100644
--- a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/load/LoadersManager.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/load/LoadersManager.java
@@ -29,6 +29,8 @@ import org.eclipse.linuxtools.internal.tmf.ui.Activator;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.SDView;
import org.eclipse.ui.IViewReference;
import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
/**
* Manager class for the UML2SD extension point.
@@ -161,7 +163,13 @@ public class LoadersManager {
return null;
}
- IWorkbenchPage persp = Activator.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+ // During Eclipse shutdown the active workbench window is null
+ if (window == null) {
+ return null;
+ }
+
+ IWorkbenchPage persp = window.getActivePage();
SDView sdView = view;
@@ -233,7 +241,12 @@ public class LoadersManager {
if ((currentLoader != null) && (currentLoader != loader)) {
if (loader != null) {
- IWorkbenchPage persp = Activator.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+ // During Eclipse shutdown the active workbench window is null
+ if (window == null) {
+ return;
+ }
+ IWorkbenchPage persp = window.getActivePage();
try {
// Search view corresponding to the viewId
SDView sdview = null;
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/loader/TmfUml2SDSyncLoader.java b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/loader/TmfUml2SDSyncLoader.java
index 5c39b7d..85c32be 100644
--- a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/loader/TmfUml2SDSyncLoader.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/uml2sd/loader/TmfUml2SDSyncLoader.java
@@ -534,6 +534,15 @@ public class TmfUml2SDSyncLoader extends TmfComponent implements IUml2SDLoader,
if (window != null) {
window.getSelectionService().removePostSelectionListener(this);
}
+
+ if (fIndexRequest != null) {
+ if (!fIndexRequest.isCompleted()) {
+ fIndexRequest.cancel();
+ }
+ fIndexRequest = null;
+ }
+ cancelOngoingRequests();
+
fView.setSDFindProvider(null);
fView.setSDPagingProvider(null);
fView.setSDFilterProvider(null);
@@ -1501,6 +1510,9 @@ public class TmfUml2SDSyncLoader extends TmfComponent implements IUml2SDLoader,
*/
protected static class IndexingJob extends Job {
+ /**
+ * @param name The job name
+ */
public IndexingJob(String name) {
super(name);
}