About Qt 4.5 and the way it handles QPixmap / QImage

Mark Kretschmann kretschmann at kde.org
Sat Mar 14 07:09:00 CET 2009

Hey all,

I found this interesting thread on the kde-core-devel mailing list,
discussing differences in the way Qt 4.5 handles certain graphics
operations, as opposed to older versions. These subtle differences can
introduce _very_ hard to trace down bugs, with code that worked just
fine with former Qt versions.

Here's an example quote from the discussion:

"Funny, yesterday I found the reason for an annoying crash in one of my PyQt
apps which happened only on Windows.  The reason was that I converted a QImage
into a QPixmap and threw away the QImage.  With X11, this is perfectly fine,
since the memory has been transferred into the X server, but with Windows'
graphics system (and likely also with Qt's newer, optimized systems) where the
conversion is cheap and does not copy the memory, this may lead to free'd
memory being referenced.  (And yes, I also had delayed crashes upon the first
window resize/repaint/...)"

The full thread can be found here:


Mark Kretschmann
Amarok Developer
www.kde.org - amarok.kde.org

More information about the Amarok-devel mailing list