Our application sometimes crashes when using cached fonts after exporting a PDF, because a font engine that is in the cache has been deleted. I tried to reproduce this in a smaller test case, but unfortunately couldn't - however we have a 100% reproducible case in our application.
Exporting a PDF (or EPS) file with QPrinter uses a QFontSubset when embedding fonts. The destructor of this class deletes its QFontEngine if the reference count is zero, but it doesn't check the cache count. I think this is the problem - there's nothing stopping the font engine from being destroyed when it's still stored in the cache.
The fix should be simple: just add a check for cache_count == 0 in the QFontSubset destructor, before the font engine is destroyed.