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.

Exception if Renderable.tint is not coming from pool.pull("Color"....)

See original GitHub issue

Describe the bug I just came along the “tint” feature of renderables. I now use it heavily on my players and on the BitmapText objects. I just realized that if I am using

BitmapText txt = new BitmapText(10, 15, {
  fillStyle: pool.pull("Color", 255,55,55),
   text: "Hey there"
});

this.addChild(txt);

Everything is fine. But if I am using something like

fillStyle: "#ff5555"

I get an exception like as soon as the Stage is destroyed (mostly on onDestroyEvent()).

melonjs.module.js:1958 Uncaught Error: me.pool: object #00ffa0 cannot be recycled
    at ObjectPool.push (melonjs.module.js:1958:23)
    at BitmapText.destroy (melonjs.module.js:18763:18)
    at BitmapText.destroy (melonjs.module.js:34989:15)
    at PlayerEntry.removeChildNow (melonjs.module.js:20969:31)
    at PlayerEntry.reset (melonjs.module.js:20464:22)
    at PlayerEntry.destroy (melonjs.module.js:21172:14)
    at MenuComponent.removeChildNow (melonjs.module.js:20969:31)
    at MenuComponent.reset (melonjs.module.js:20464:22)
    at MenuComponent.destroy (melonjs.module.js:21172:14)
    at World.removeChildNow (melonjs.module.js:20969:31)
push @ melonjs.module.js:1958
destroy @ melonjs.module.js:18763
destroy @ melonjs.module.js:34989
removeChildNow @ melonjs.module.js:20969
reset @ melonjs.module.js:20464
destroy @ melonjs.module.js:21172
removeChildNow @ melonjs.module.js:20969
reset @ melonjs.module.js:20464
destroy @ melonjs.module.js:21172
removeChildNow @ melonjs.module.js:20969
reset @ melonjs.module.js:20464
reset @ melonjs.module.js:21776
emit @ melonjs.module.js:4490
emit @ melonjs.module.js:5110
reset @ melonjs.module.js:21972
reset @ melonjs.module.js:22923
_switchState @ melonjs.module.js:23249
setTimeout (async)
defer @ melonjs.module.js:1781
eval @ melonjs.module.js:23691
update @ melonjs.module.js:33888
update @ melonjs.module.js:21220
update @ melonjs.module.js:21867
update @ melonjs.module.js:22939
update @ melonjs.module.js:22052
_renderFrame @ melonjs.module.js:23211
requestAnimationFrame (async)
_renderFrame @ melonjs.module.js:23216
requestAnimationFrame (async)
_renderFrame @ melonjs.module.js:23216
requestAnimationFrame (async)
_renderFrame @ melonjs.module.js:23216
requestAnimationFrame (async)
_renderFrame @ melonjs.module.js:23216
requestAnimationFrame (async)
_renderFrame @ melonjs.module.js:23216
requestAnimationFrame (async)
_renderFrame @ melonjs.module.js:23216
requestAnimationFrame (async)
_renderFrame @ melonjs.module.js:23216
requestAnimationFrame (async)
_renderFrame @ melonjs.module.js:23216
requestAnimationFrame (async)
_renderFrame @ melonjs.module.js:23216
requestAnimationFrame (async)
_renderFrame @ melonjs.module.js:23216
requestAnimationFrame (async)
_renderFrame @ melonjs.module.js:23216
requestAnimationFrame (async)
_renderFrame @ melonjs.module.js:23216
requestAnimationFrame (async)
_renderFrame @ melonjs.module.js:23216
requestAnimationFrame (async)
_renderFrame @ melonjs.module.js:23216
requestAnimationFrame (async)
_renderFrame @ melonjs.module.js:23216
requestAnimationFrame (async)
_renderFrame @ melonjs.module.js:23216
requestAnimationFrame (async)
_renderFrame @ melonjs.module.js:23216
requestAnimationFrame (async)
_renderFrame @ melonjs.module.js:23216
requestAnimationFrame (async)
_renderFrame @ melonjs.module.js:23216
requestAnimationFrame (async)
_renderFrame @ melonjs.module.js:23216
requestAnimationFrame (async)
_renderFrame @ melonjs.module.js:23216
requestAnimationFrame (async)
_renderFrame @ melonjs.module.js:23216
requestAnimationFrame (async)
_renderFrame @ melonjs.module.js:23216
requestAnimationFrame (async)
_renderFrame @ melonjs.module.js:23216
requestAnimationFrame (async)
_renderFrame @ melonjs.module.js:23216
requestAnimationFrame (async)
_renderFrame @ melonjs.module.js:23216
requestAnimationFrame (async)
_renderFrame @ melonjs.module.js:23216
requestAnimationFrame (async)
_renderFrame @ melonjs.module.js:23216
requestAnimationFrame (async)
_renderFrame @ melonjs.module.js:23216
requestAnimationFrame (async)
_renderFrame @ melonjs.module.js:23216
requestAnimationFrame (async)
_renderFrame @ melonjs.module.js:23216

melonjs.module.js:1992 Uncaught TypeError: Cannot read properties of undefined (reading 'className')
    at ObjectPool.poolable (melonjs.module.js:1992:29)
    at ObjectPool.push (melonjs.module.js:1956:19)
    at BitmapText.destroy (melonjs.module.js:34983:14)
    at PlayerEntry.removeChildNow (melonjs.module.js:20969:31)
    at PlayerEntry.reset (melonjs.module.js:20464:22)
    at PlayerEntry.destroy (melonjs.module.js:21172:14)
    at MenuComponent.removeChildNow (melonjs.module.js:20969:31)
    at MenuComponent.reset (melonjs.module.js:20464:22)
    at MenuComponent.destroy (melonjs.module.js:21172:14)
    at World.removeChildNow (melonjs.module.js:20969:31)

Live Example

  • please do provide a live example using either of the below melonjs sandbox example :

Desktop (please complete the following information):

  • OS: macOS 12.4
  • Browser Chrome 104
  • melonJS 13.2.0 (preRelease)

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
obiotcommented, Aug 21, 2022

Fantastic ! I will publish the 13.2 version tomorrow then 😃

thanks as well for all the feedback and help !

1reaction
obiotcommented, Aug 21, 2022

done ! if you have the time to give it a quick test (I also update all the dist files).

However you should really not do Sprite.tint = new Color(r,g,b); because you really create a Color object for nothing. with the new setter, however you can do Sprite.tint = "#rgb";

Read more comments on GitHub >

github_iconTop Results From Across the Web

Window Tinting Standards - Texas Department of Public Safety
Window Tint Standards can be found in the Texas Administrative Code, ... Sunscreening devices may not be red, amber, or blue in color....
Read more >
View - Android Developers
View IDs need not be unique throughout the tree, but it is good practice to ... android:outlineAmbientShadowColor, Sets the color of the ambient...
Read more >
Tinted Window Exemption Application - Oklahoma.gov
I hereby make application to the Oklahoma Department of Public Safety for exemption from the tinted window restriction as set forth in 47....
Read more >
Medical Exemption to Window Tint Law
The applicant is required to grant permission to their physician/optometrist to discuss the specified medical condition with the Department of Public Safety, ...
Read more >
Annotated List of Command-line Options - ImageMagick
Below is list of command-line options recognized by the ImageMagick command-line tools. If you want a description of a particular option, ...
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