[FLAMINGO-59] Allow JRibbonFrames to be garbage collected after disposal Created: 23/Nov/09  Updated: 25/Nov/09

Status: Open
Project: flamingo
Component/s: ribbon
Affects Version/s: 5.0
Fix Version/s: milestone 1

Type: Improvement Priority: Critical
Reporter: flynnk Assignee: kirillcool
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Operating System: All
Platform: All

Issuezilla Id: 59


JRibbonFrame registers several listeners with the AWT Toolkit that are not
removed when the window is disposed(). The culprits are the AWTEventListener
and KeyTipManager.KeyTipListener registered in initRibbonFrame().

If we open up a JRibbonFrame and then close it, all resources associated with
that frame are held onto as it cannot be garbage collected due to these
listeners. This makes a pattern where we construct and show JRibbonFrames on
demand, and then destroy them when they are closed difficult due to the
resulting memory leak.

Since JRibbonFrame is the only supported way of accessing the Ribbon, it is very
hard to work around this. For the AWTEventListener you can work out which
listener the constructor added in a subclass and hold on to a reference to it to
remove it when the frame is closed, but for the key tip listener, there is no
way to view the current listener list and grab the last entry. We could
probably work around this if the KeyTipManager had a public method to return all
listeners--if the larger issue is more difficult to fix in the short term, the
addition of a getKeyTipListeners() method would likely enable a workaround.

These references were from tracing down what was referencing the JRibbonFrame in
the NetBeans heap walker.

Comment by kirillcool [ 25/Nov/09 ]

Moving to version 5.0

Generated at Wed Mar 29 22:19:15 UTC 2017 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.