[PyQt] Segfault with QRawFont

Phil Thompson phil at riverbankcomputing.com
Sun Nov 11 15:50:40 GMT 2012


On Sun, 28 Oct 2012 23:12:35 +0530, Kovid Goyal <kovid at kovidgoyal.net>
wrote:
> Blanket not calling dtors would be problematic, there's no way to be
> sure what side effects that would have. One solution would be to
> specialize the dealloc function for QRawFont objects to check if the
> application is exiting and abort. 
> 
> Another might be to register a cleanup function using the atexit module
> that calls deletes all QRawFont objects (at least their underlying C++
> objects), though since atexit is
> called from Py_Finalize() that would only work if Qt hasn't released
> FreeType at that time.

For the moment I've implemented the (optional) blanket not calling dtors
in the form of sip.setdestroyonexit(). People can try this if they are
seeing crashes on exit and we'll see if it turns out to be problematic. If
not I may make it the default for PyQt5.

I'd rather not special case QRawFont if it can be avoided - I'm sure there
are lots of similar special cases.

Phil


More information about the PyQt mailing list