Label::creatWithTTF not caching font atlas: weird system lock on font

I’m using coco2d-x 3.1 on windows, and I’ve come across something rather interesting.

I create my label with:

Label::createWithTTF("text", "ProximaNova-Thin.ttf", 45)

and I can see if create a font atlas, and store it in the _atlasMap cache in CCFontAtlasCache.cpp. I see it store the font atlas into the cache and return my font. It renders perfectly.

Later on in another view, I create a label again, and the ProximaNova-Thin font atlas is no longer found in the cache, and reads the font file off the filesystem again. I placed a breakpoint in purgeCachedData to see if the cache was being purged at some point; however, it was never called.

Even stranger is that there exists a SYSTEM lock on that font (not the app’s process), that will only be release if the program terminates successfully. The irony is, with that lock on the font, FileUtils is unable to open the font, so it can’t create the atlas, and returns a null label. If the program crashes, and I try to force unlock the file with ProcessExplorer, it says there is a bad handle on the file. Only solution is to logout and log back in.

App runs great on OSX, iOS and Android; this has only been an issue with win32.

Has anyone run into an issue like this?

You might consider upgrading to v3.2. There were a number of Label fixes.

Thanks @slackmoehrle, I saw that in the changelog so I’m trying it out right now to see if it make a difference.

if you want the absolute latest, as there are more label fixes, you could grab the latest from GitHub and run download-deps.py.