Details
-
Bug
-
Resolution: Incomplete
-
Not Evaluated
-
None
-
4.6.0
-
None
-
Ubuntu 10.04 / Qt 4.6 / X11 graphics system
Description
If a QPainter is created on a device after QApplication setup and then ended after the QApplication is torn down,
Qt crashes if using the X11 engine but not the raster engine.
{{ #include <QtGui/QApplication> #include <QtGui/QPainter> #include <QtGui/QPixmap> int main(int argc, char** argv) { QPixmap* pixmap; QPainter* painter; { QApplication app(argc,argv); painter = new QPainter; pixmap = new QPixmap(100,100); painter->begin(pixmap); } painter->end(); } }}
This bug report was distilled from a more complex issue involving <canvas> in WebKit and garbage collection. I am unsure if the code above should be considered legitimate or not (in other words, is the crash here an unexpected bug in Qt?). In QtWebKit, a QPainter is created for WebCore::ImageBufferData which may be active until it is destroyed during garbage collection which may happen right at the end of ~QApplication when the WebCore::SharedTimerQt singleton is destroyed, if there is a WebKit GC cycle pending. The attached test case project triggers this case when used with Qt 4.6 / X11. I did not experience a crash when using a Qt trunk build but that uses the raster engine by default.