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

Trying to access source on txLoaded triggers a max call stack exception #447

Closed
ricardo-a-alves-alb opened this issue Feb 6, 2023 · 0 comments · Fixed by #451 or #514
Closed

Trying to access source on txLoaded triggers a max call stack exception #447

ricardo-a-alves-alb opened this issue Feb 6, 2023 · 0 comments · Fixed by #451 or #514
Assignees

Comments

@ricardo-a-alves-alb
Copy link
Contributor

ricardo-a-alves-alb commented Feb 6, 2023

Relates to #348

I was trying to access the renderInfo property moreTextLines to check if the text content has overflown. However, the only way I found to access this property is to listen to the txLoaded event of the TextTexture and access the TextureSource.

However, this triggers a max call stack exception because the texture is flagged to be updated on this piece of code:

get source() {
if (this._mustUpdate || this.stage.hasUpdateSourceTexture(this)) {
this._performUpdateSource(true);
this.stage.removeUpdateSourceTexture(this);
}
return this._source;
}

this.stage.hasUpdateSourceTexture(this) always returns true, causing a loop. Is this a bug or I should access renderInfo through some other route?

DEMO

Relevant DEMO code:

this.tag('LongText').on('txLoaded', (texture) => {
    // if we access texture.source, max call stack is triggered
    const label = texture._source.renderInfo.moreTextLines
    this.tag('RemainingLines.Label').text.text = label
})

If the _template already has an initial text defined, it doesn't seem to trigger the exception. However, if we patch a new text after it has been fully initialized, it triggers the exception.

@g-zachar g-zachar added the bug label Feb 8, 2023
@frank-weindel frank-weindel linked a pull request Feb 13, 2023 that will close this issue
@uguraslan uguraslan self-assigned this Apr 3, 2023
@uguraslan uguraslan added the fix-in-review This issue has a PR in review label Apr 3, 2023
@uguraslan uguraslan added fixed and removed fix-in-review This issue has a PR in review labels Oct 10, 2023
@uguraslan uguraslan added this to the October 2023 release milestone Oct 10, 2023
@uguraslan uguraslan mentioned this issue Oct 11, 2023
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants