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

Saving a QImage to BMP will cause it to detach

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • 5.0.0
    • 4.5.3, 4.6.2, 4.7.1
    • Image formats
    • None
    • Windows XP
      Qt 4.5.3, 4.6.2, 4.7.x
    • c7e21f392355fddcf586815ed42279a3663bf981

    Description

      Location: src/gui/image/qbmphandler.cpp, function qt_write_dib, lines 592, 609 and 619

      Because the argument 'QImage image' is non-const, the calls to QImage::scanLine on the aforementioned lines will cause an unnecessary detach.

      Solution (as used in other image format handlers): change

        image.scanLine(y)
      

      into

        static_cast<const QImage&>(image).scanLine(y)
      

      and make pointer p declared on line 604 const.

      Attachments

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

        Activity

          People

            kkalland Kim Motoyoshi Kalland (Inactive)
            bswerts Ben Swerts
            Votes:
            3 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes