Community
Participate
Working Groups
According to bug# 62252 the quick menu action leaks its context menu. Index: QuickMenuAction.java =================================================================== RCS file: /home/eclipse/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/actions/Q uickMenuAction.java,v retrieving revision 1.3 diff -u -r1.3 QuickMenuAction.java --- QuickMenuAction.java 24 May 2004 14:11:58 -0000 1.3 +++ QuickMenuAction.java 31 May 2004 22:34:31 -0000 @@ -43,6 +43,7 @@ public abstract class QuickMenuAction extends Action { private static final int CHAR_INDENT= 3; + private Menu fQuickMenu; /** * Creates a new quick menu action with the given command id. @@ -67,14 +68,26 @@ MenuManager menu= new MenuManager(); fillMenu(menu); - final Menu widget= menu.createContextMenu(focus.getShell()); - Point location= computeMenuLocation(focus, widget); + if (fQuickMenu != null) { + fQuickMenu.dispose(); + fQuickMenu = null; + } + + fQuickMenu= menu.createContextMenu(focus.getShell()); + Point location= computeMenuLocation(focus, fQuickMenu); if (location == null) return; - widget.setLocation(location); - widget.setVisible(true); + fQuickMenu.setLocation(location); + fQuickMenu.setVisible(true); } + public void dispose() { + if (fQuickMenu != null) { + fQuickMenu.dispose(); + fQuickMenu = null; + } + } + /** * Hook to fill a menu manager with the items of the sub menu. *
Must fix for RC2.
I fixed this by running an event loop after the menu gets visible. This avoids the problem that the menu is still referenced until it gets opened the next time. The code I added is as follows: while (!widget.isDisposed() && widget.isVisible()) { if (!display.readAndDispatch()) display.sleep(); } if (!widget.isDisposed()) { widget.dispose(); } Michael, you might want to consider using this fix in your implementaiton of QuickMenuAction.
Fixed for > I20040607
start verifying
verified in I200406110010 through code inspection