Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory leak in TextPushButton #833

Closed
pixelzoom opened this issue Mar 3, 2023 · 2 comments
Closed

Memory leak in TextPushButton #833

pixelzoom opened this issue Mar 3, 2023 · 2 comments

Comments

@pixelzoom
Copy link
Contributor

pixelzoom commented Mar 3, 2023

Discovered during phetsims/reactants-products-and-leftovers#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

So TextPushButton needs to override dispose and handle this.

@pixelzoom pixelzoom self-assigned this Mar 3, 2023
pixelzoom added a commit that referenced this issue Mar 3, 2023
@pixelzoom
Copy link
Contributor Author

The tandem leak was introduced first, so assigning to @zepumph to review. Close if OK.

@zepumph
Copy link
Member

zepumph commented Mar 3, 2023

Yes very good. Thanks for the catch.

@zepumph zepumph closed this as completed Mar 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants