aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemy Suen2010-05-09 10:02:02 (EDT)
committerRemy Suen2010-05-09 10:02:02 (EDT)
commit92136a31eca6ef4dbbe330dabefbc696b2104045 (patch)
treea44bbe96641e2e789fba04b78e822d3b0088eb9e
parent5275585476adf85d8cd88f81ba5f05e04c65b5cf (diff)
downloadegit-92136a31eca6ef4dbbe330dabefbc696b2104045.zip
egit-92136a31eca6ef4dbbe330dabefbc696b2104045.tar.gz
egit-92136a31eca6ef4dbbe330dabefbc696b2104045.tar.bz2
Prevent leaking of SWT menus in the 'Git Repositories' viewrefs/changes/69/669/1
New instances of SWT menus are currently being instantiated and set on the tree control every time a user brings up the context menu in the 'Git Repositories' view. When the tree is disposed, the tree's menu is also disposed. However, as new menus are instantiated and set every time, those menus that have been replaced are now lying around and will only be disposed when the shell itself is disposed. Change-Id: Ia77bf8cbd8cd3ef27e536821dd979e0882926f44
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/RepositoriesView.java8
1 files changed, 5 insertions, 3 deletions
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/RepositoriesView.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/RepositoriesView.java
index 65f8d8b..a25b029 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/RepositoriesView.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/RepositoriesView.java
@@ -388,9 +388,11 @@ public class RepositoriesView extends ViewPart implements ISelectionProvider,
tv.getTree().addMenuDetectListener(new MenuDetectListener() {
public void menuDetected(MenuDetectEvent e) {
-
- tv.getTree().setMenu(null);
- Menu men = new Menu(tv.getTree());
+ Menu men = tv.getTree().getMenu();
+ if (men != null) {
+ men.dispose();
+ }
+ men = new Menu(tv.getTree());
TreeItem testItem = tv.getTree().getItem(
tv.getTree().toControl(new Point(e.x, e.y)));