feathersui / feathersui-openfl

Cross-platform graphical user interface components for creative frontend projects — powered by Haxe and OpenFL
https://feathersui.com/
Other
160 stars 16 forks source link

ListView: optional dispose method that ensures that all item renderers are destroyed #144

Closed joshtynjala closed 1 year ago

joshtynjala commented 1 year ago

In the general case, it should be enough to remove from stage and let the garbage collector handle things. However, if a custom item renderer absolutely needs specific things cleaned up to avoid memory leaks (which should be rare), then this m ethod should be available as an opt-in feature for those who need to ensure that the DisplayObjectRecycler.destroy method is called when a ListView is no longer needed. This method will not be called automatically under any circumstances.

Until this method is available, setting dataProvider to null and calling validateNow() is probably enough to ensure that DisplayObjectRecycler.destroy is called for all item renderers.