TheInfiniteKind / moneydance_open

16 stars 12 forks source link

LEAKREF 24.0 - GraphSet / LineGraphSection holds onto currency (locking dataset references) #108

Closed yogi1967 closed 3 months ago

yogi1967 commented 9 months ago

GraphSet.LineGraphSection stores 'currency' GraphViewer.CurrencyNumberFormat stores 'curr'

Refer screenshot. The jfree charting tools store things like tooltips in a global static list. The graphing tools we use generate tooltips and these store CurrencyType. Thus they seem to hang around forever.....

I have my own copy classes of the MD code and have seen the same bug. I've reproduced it in MD code.

I've now changed LineGraphSection and CurrencyNumberFormat to store the reference to CurrencyType as a WeakReference() so that they can be garbage collected when the main graph windows die.

The GraphViewer.CurrencyNumberFormat(), the xxxToolTipGenerators(), and setGraph() have to use .get() of course for the currency type reference....

Can you make the same changes in the MD code?

book in com.infinitekind.moneydance.model.CurrencyType#4
currency in com.moneydance.apps.md.view.gui.graphtool.GraphSet$LineGraphSection#2
seriesKey in org.jfree.chart.entity.LegenditemEntity#1
[2] in fIjava.lang.Object#44801: 244 items
elementData in java.util.ArrayList#37786 : 236 elements
I entities in org.jfree.chart.entity.StandardEntity Collection# 1
I entities in org.jfree.chart.ChartRendering Info#1
info in org.jfree.chart.ChartPanel#1
insideComponent in javax.swing. ToolTipManager#1
a in java.awt.AWTEventMulticaster#1097
mouseListener
temporaryLostComponent in JFrame
graph
yogi1967 commented 3 months ago

Code fix suggested... 🤞

yogi1967 commented 3 months ago

fixed in 5102