question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Creating a new BitmapText object fails after calling destroy on a previous one when using a font that is split up into multiple pages.

See original GitHub issue

Expected Behavior

To create BitmapText objects without any errors.

Current Behavior

Creating a new BitmapText after destroying a previous one results in a Cannot read properties of null (reading 'alphaMode') error.

Steps to Reproduce

Like I did here. Create a BitmapText object with an initial value of characters that are from 2 different pages and add it to the stage. Wait for at least one frame and change the text to a character that is in only one of the pages. Wait for another frame and destroy the BitmapText object. After that, try creating a new BitmapText with any of the previous characters used and observe the error.

Environment

  • pixi.js version: 6.5.5
  • Browser & Version: Chrome 105, Firefox 105, Brave 1.144
  • OS & Version: Windows 10
  • Running Example: example

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
tylerfurtwanglercommented, Oct 14, 2022

Thanks @SuperSodaSea I have opened https://github.com/pixijs/pixijs/issues/8732, feel free to update it as needed. I provided links for reproducing in v6.5.6 and showing that it does not reproduce in v6.5.2 but it sounds like you already have a clear idea of the cause.

1reaction
bigtimebuddycommented, Oct 10, 2022

Assigning to Texture.EMPTY to used pool textures on destroy fixed this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Creating a new BitmapText object fails after calling destroy on ...
Creating a new BitmapText object fails after calling destroy on a previous one when using a font that is split up into multiple...
Read more >
Phaser 3 API Documentation - Class: BitmapText
Controls the alignment of each line of text in this BitmapText object. Only has any effect when this BitmapText contains multiple lines of...
Read more >
new PIXI.BitmapText (text, style) - PixiJS
A BitmapText object will create a line or multiple lines of text using bitmap font. The primary advantage of this class over Text...
Read more >
Phaser.BitmapText - 2.6.2 - Learn
BitmapText objects work by taking a texture file and an XML or JSON file that describes the font structure. It then generates a...
Read more >
PIXI.BitmapText
A BitmapText object will create a line or multiple lines of text using bitmap ... case the font is in a file called...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found