Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-18058

Crash in QPainter::end() called on painter after QApplication teardown with X11 engine

    XMLWordPrintable

Details

    • Bug
    • Resolution: Incomplete
    • Not Evaluated
    • None
    • 4.6.0
    • GUI: Painting
    • 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.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            rodal Samuel Rødal
            robertknight Robert Knight
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes