[516645] Fix memory leak in EMFCompareContentMergeViewer81/97081/4
commit4f6fd746027b05ad173d552f18885103c46c6d2a
authorPhilip Langer <planger@eclipsesource.com>
Mon, 15 May 2017 11:44:12 +0000 (15 13:44 +0200)
committerPhilip Langer <planger@eclipsesource.com>
Tue, 23 May 2017 15:36:39 +0000 (23 11:36 -0400)
tree4c336f0ac58430cbbd4ed6bac26a8ee562a60055
parent61d930a00467d3a8e9b65ded25e93431084fad5b
[516645] Fix memory leak in EMFCompareContentMergeViewer

With this change, we do the following on dispose:
menuService.releaseContributions(toolBarManager);
menuService.populateContributionManager(toolBarManager, "nothing");
menuService.releaseContributions(toolBarManager);

The first call clears the contributions of the toolbar manager. The
second populates again but with an empty toolbar manager and a location
that presumably has no contributions, resulting in a still empty toolbar
manager, but the important point is that it it reconciles with the
current state, ensuring that all the old items are cleared.

I'm not sure if this situation represents a bug in the IMenuService
implementation or if EMF Compare is abusing it. Anyway, this change
fixes the leak on EMF Compare side.

Bug: 516645
Change-Id: I8f1b07781656e828ac8b6eca0f3f7a36be7cb0ae
Signed-off-by: Philip Langer <planger@eclipsesource.com>
plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/EMFCompareContentMergeViewer.java