diff options
authorRemy Suen2010-05-09 10:02:02 (EDT)
committer Remy Suen2010-05-09 10:02:02 (EDT)
commit92136a31eca6ef4dbbe330dabefbc696b2104045 (patch)
parent5275585476adf85d8cd88f81ba5f05e04c65b5cf (diff)
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
1 files changed, 5 insertions, 3 deletions
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/
index 65f8d8b..a25b029 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/
@@ -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)));