[Interest] QPixmap and threads

maitai maitai at virtual-winds.org
Fri May 5 09:05:09 CEST 2017


I have read in many places that QPixmaps should not be used in threads 
(Qt5.8/QtConcurrent in my case).

In fact I have discovered that fact only recently, because I had a 
random crash occurring on QPixmap::load(), and in the end that was 
occurring when QPixmap::load() was used exactly at the same time from 
different threads.

I changed this part to QImage, OK.

But still, I have hundreds of other QPixmaps used in threads, with no 
problem at all (creating, painting, etc). All is working fine for years, 
without any warning or so from Qt. Should I change also all these 
QPixmaps to QImages (with a conversion cost at the end of the threads)?

If QPixmaps are forbidden outside the main GUI thread, why is it not 
written in the documentation?

Thanks for any lights on this
Philippe Lelong

More information about the Interest mailing list