Fix for QPainter finalize