This Bugzilla instance is deprecated, and most Eclipse projects now use GitHub or Eclipse GitLab. Please see the deprecation plan for details.
Bug 431778 - [Contributions] ToolbarManagerRenderer.cleanup is not called when toolbar not created by the rendered are disposed.
Summary: [Contributions] ToolbarManagerRenderer.cleanup is not called when toolbar not...
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.4   Edit
Hardware: PC Windows 8
: P3 major (vote)
Target Milestone: 4.4 M7   Edit
Assignee: Paul Webster CLA
QA Contact: Daniel Rolka CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-04-02 03:39 EDT by Maxime Porhel CLA
Modified: 2014-05-05 09:35 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Maxime Porhel CLA 2014-04-02 03:39:28 EDT
In Sirius, we recently have fixed Bug 431634, a memory leak: each opened editor was retained in a wrongly disposed action contributed to our diagram editor internal tool bar. 

During validation of our fix, a Yourkit snapshot taken during a junit test suite showed that 2109 ToolbarContributionRecord are still retained in the ToolbarManagerRenderer.

Our toolbar is mainly populated through contribution factories (See Bug 410426) and the extension point org.eclipse.ui.menus.ExtensionContributionFactory. The Sirius diagram editor creates the toolbar and its manager, then it asks the menu service of the editor site to populate the toolbar with contributions (IMenuService.populateContributionManager). 

In debug, we discovered that org.eclipse.e4.ui.workbench.renderers.swt.ToolBarManagerRenderer.cleanUp(MToolBar) does not clean the records corresponding to our toolbar: the dispose listener is added only to the toolbar created by the ToolBarManagerRenderer.

I think this dispose listener should be added on all toolbar: maybe in processContributions ? (which can be called from the workbench menu service)
Comment 1 Maxime Porhel CLA 2014-04-02 04:31:05 EDT
See https://git.eclipse.org/r/24304 for potential fix.

On Sirius, each diagram editor open/close add around 50 retained ToolbarContributionRecord. With the proposed fix, the cleanup is well done.
Comment 2 Paul Webster CLA 2014-04-09 10:00:38 EDT
Released as http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=f01438295d4a1650a36d4c0605cd3523a7f80136 with minor changes.

Thanks Maxime.

PW
Comment 3 Paul Webster CLA 2014-04-21 09:59:08 EDT
There's a bug in this code, as we add the tag and it is saved to the workbench.xmi.  That means it will never get re-added on new sessions.

PW
Comment 4 Paul Webster CLA 2014-04-25 10:04:20 EDT
M7 ends today, do I have to pull this fix?

PW
Comment 5 Paul Webster CLA 2014-04-25 10:17:47 EDT
Oh, had a quick idea to put it in transient data.  Fixed with http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=6f5c8886d7c14b787e344df4ced9ab31a82252f2

PW
Comment 6 Paul Webster CLA 2014-04-29 16:02:11 EDT
I confirmed this in 4.4.0.I20140428-2000.

Maxime, could you also confirm this is working in your scenarios?

PW
Comment 7 Paul Webster CLA 2014-04-29 16:02:49 EDT
.
Comment 8 Pierre-Charles David CLA 2014-04-30 03:24:43 EDT
(In reply to Paul Webster from comment #6)
> I confirmed this in 4.4.0.I20140428-2000.
> 
> Maxime, could you also confirm this is working in your scenarios?

Hi Paul. Maxime is not available this week. I'll try to have a look, but I did not follow the details of this issue, and I'm not sure I'll have the time to dig into it. I know Maxime considered the two related issues in Sirius as resolved (bug #428322 and bug #431634) and I believe he checked against platform I-builds with the fix included. If you don't hear from us, consider it's OK on our side.
Comment 9 Maxime Porhel CLA 2014-05-05 06:28:13 EDT
Hi Paul, 

I confirm this is working with our scenarios. I have checked with a fresh Sirius M7 RC1 build and Luna M7 (Build id: I20140501-0200).

Regards, 

Maxime
Comment 10 Paul Webster CLA 2014-05-05 09:35:41 EDT
Thanks
PW