Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Loskutov2019-08-19 11:45:05 -0400
committerAndrey Loskutov2019-08-19 11:53:09 -0400
commitb84b4ceb1ec4d8c15002a30bfa648896f58d7e4c (patch)
tree8d85076fe7d768fc47612bc49b43307f1eb39051
parentab8841ea6c504ad3409788ee2ca78869e8954939 (diff)
downloadeclipse.platform.team-R4_13_maintenance.tar.gz
eclipse.platform.team-R4_13_maintenance.tar.xz
eclipse.platform.team-R4_13_maintenance.zip
- similar to what getTargetPart() is doing, return active page - if the "target" part is disposed, set it to null to avoid memory leaks Change-Id: I41e2fc0491b6c9eb524ecb02cd69f7a613ff819b Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/TeamAction.java21
1 files changed, 17 insertions, 4 deletions
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/TeamAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/TeamAction.java
index b7e6d1513..6653f89d3 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/TeamAction.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/TeamAction.java
@@ -100,7 +100,11 @@ public abstract class TeamAction extends AbstractHandler implements IObjectActio
@Override
public void partClosed(IWorkbenchPartReference partRef) {
- if (targetPart == partRef.getPart(false)) {
+ if(targetPart == null) {
+ return;
+ }
+ IWorkbenchPart part = partRef.getPart(false);
+ if (targetPart == part) {
targetPart = null;
}
}
@@ -425,8 +429,17 @@ public abstract class TeamAction extends AbstractHandler implements IObjectActio
* @return IWorkbenchPage
*/
protected IWorkbenchPage getTargetPage() {
- if (getTargetPart() == null) return TeamUIPlugin.getActivePage();
- return getTargetPart().getSite().getPage();
+ IWorkbenchPart target = getTargetPart();
+ if (target == null) {
+ return TeamUIPlugin.getActivePage();
+ }
+ IWorkbenchPage page = target.getSite().getPage();
+ if(page == null) {
+ // part was disposed => null targetPart to avoid memory leak
+ targetPart = null;
+ return TeamUIPlugin.getActivePage();
+ }
+ return page;
}
/**
@@ -466,7 +479,6 @@ public abstract class TeamAction extends AbstractHandler implements IObjectActio
@Override
public void dispose() {
- super.dispose();
if(window != null) {
window.getSelectionService().removePostSelectionListener(selectionListener);
if (window.getActivePage() != null) {
@@ -479,6 +491,7 @@ public abstract class TeamAction extends AbstractHandler implements IObjectActio
window = null;
targetPart = null;
shell = null;
+ super.dispose();
}
/**

Back to the top