Closed pixelzoom closed 1 year ago
Discovered during https://github.com/phetsims/reactants-products-and-leftovers/issues/78.
TextPushButton is a subclass of RectangularPushButton that creates its own content:
options.content = new Text( text, combineOptions<TextOptions>( { font: options.font, fill: options.textFill, maxWidth: options.maxTextWidth, tandem: options.tandem.createTandem( 'text' ) }, options.textNodeOptions ) );
There are 2 memory leaks associated with options.content:
(1) It registers a tandem, added by @zepumph (2) It may be like to a TReadOnlyProperty<string>, added by @jonathanolson
TReadOnlyProperty<string>
So TextPushButton needs to override dispose and handle this.
dispose
The tandem leak was introduced first, so assigning to @zepumph to review. Close if OK.
Yes very good. Thanks for the catch.
Discovered during https://github.com/phetsims/reactants-products-and-leftovers/issues/78.
TextPushButton is a subclass of RectangularPushButton that creates its own content:
There are 2 memory leaks associated with options.content:
(1) It registers a tandem, added by @zepumph (2) It may be like to a
TReadOnlyProperty<string>
, added by @jonathanolsonSo TextPushButton needs to override
dispose
and handle this.