Bug 55592 - [Contributions] SubActionBars does not properly handle menu listeners
Summary: [Contributions] SubActionBars does not properly handle menu listeners
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 3.0 M8   Edit
Assignee: Nick Edgar CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-03-22 16:29 EST by Nick Edgar CLA
Modified: 2004-03-22 18:02 EST (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Edgar CLA 2004-03-22 16:29:31 EST
build I20040318

While investigating a leak of Java editors (bug 53473), we found that the
JavaOutlinePage's CustomFiltersActionGroup hooks a menu listener on the menu
manager of the page site's action bars.
This is a SubMenuManager.  Its implementation of addMenuListener simply
delegates to the parent.  

There are two problems here:
1. These menu listeners are not disposed when the action bars are disposed.
2. When the menu is shown, the listener is given the parent menu manager to add
to, not the sub menu manager.
Comment 1 Nick Edgar CLA 2004-03-22 16:30:26 EST
Adding Doug, FYI.
Comment 2 Nick Edgar CLA 2004-03-22 16:31:53 EST
Note that CustomFiltersActionGroup.dispose() tries to remove their menu
listener, but this dispose is never called.  This is a problem in JDT, for which
Chris is entering a separate PR.

But even if they didn't explicitly remove the listener, SubActionBars should
take care of it.
Comment 3 Nick Edgar CLA 2004-03-22 17:07:01 EST
Added SubContributionManager.disposeManager(), which does removeAll().
Changed SubMenuManager to properly virtualize menu listeners, and remove the
parent listener in disposeManager().
Changed SubActionBars.dispose() to call disposeManager() on its managers instead
of removeAll().
Fixed PageSite.dispose() to call subActionBars.dispose().

Should look for other creators of SubActionBars and ensure they call dispose.
Comment 4 Nick Edgar CLA 2004-03-22 17:19:30 EST
Found only one case, in the PDE editors: bug 55599.
Comment 5 Chris McLaren CLA 2004-03-22 18:02:07 EST
bug 55604 tracks the JDT case.