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

QImage.scaled: Crash when using QCoreApplication

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P1: Critical
    • 5.15.0 Alpha
    • 5.13.0
    • GUI: Painting
    • None
    • 8e74bf4d4aaaf582c70cbcb83caa237e2592e762 (qt/qtbase/5.15)

    Description

      Steps:

      • Instantiate a Q(Gui)Application
      • Delete it
      • Instantiate a QCoreApplication
      • Create a QImage
      • call scaled() on that image
      • run the application

      Expected:

      • No crash

      Reality:

      • Crash

       

      reproducible with this code:

      #include <QApplication>
      #include <QImage>

      #include <memory>

      namespace
      {
      // Copied from the QT Doc examples.
      // https://doc.qt.io/qt-5/qimage.html
      QImage createImage()

      { QImage image(3, 3, QImage::Format_RGB32); QRgb value; value = qRgb(189, 149, 39); // 0xffbd9527 image.setPixel(1, 1, value); value = qRgb(122, 163, 39); // 0xff7aa327 image.setPixel(0, 1, value); image.setPixel(1, 0, value); value = qRgb(237, 187, 51); // 0xffedba31 image.setPixel(2, 1, value); return image; }

      }

      int main(int argc, char *argv[])

      { auto app = std::make_unique<QApplication>(argc, argv); app.reset(); auto core_app = std::make_unique<QCoreApplication>(argc, argv); auto image = createImage(); auto scaled_image = image.scaled(5,5,Qt::KeepAspectRatio); return app->exec(); }

      Attachments

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

        Activity

          People

            vgt Eirik Aavitsland
            sandergrielens Sander Grielens
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes