Fix edge case where PixmapPacker eats all memory in infinite recursion #191

Merged
merged 1 commit into from Jan 10, 2013

Conversation

Projects
None yet
2 participants
Contributor

ttencate commented Jan 5, 2013

Please check if I got this right; there is no test for it, and I can't seem to use my own libgdx build in my game right now.

Owner

badlogic commented Jan 5, 2013

Wow, never seen this. Wonder why your patch would fix an infinite loop, but it sure looks nicer :)

Contributor

ttencate commented Jan 5, 2013

The "+ borderPixels" is on the wrong side of the ">=" sign. So if the image almost, or exactly, fits inside the page, but wouldn't fit if you include the border, no exception is thrown. But node will always be null since it doesn't fit, so a new page is created (eating an MB of ram for 512x512 pages) and the whole thing recursively starts over again :)

Owner

badlogic commented Jan 10, 2013

Wow, i thought i merged this. Sorry, merged now, thanks!

badlogic added a commit that referenced this pull request Jan 10, 2013

Merge pull request #191 from ttencate/master
Fix edge case where PixmapPacker eats all memory in infinite recursion

@badlogic badlogic merged commit 241858a into libgdx:master Jan 10, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment