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

Accidental detach in qt_bitmapToRegion

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • 5.6.1
    • 5.6.0
    • GUI: Painting
    • None
    • ac8a3b948da1980bc59bae3fc76d20b5b45662a0

    Description

      Accidental detach in qt_bitmapToRegion

       

      While looking for accidental detaches in our application, I found one was occurring frequently inside the following QT code:

      QRegionPrivate *qt_bitmapToRegion(const QBitmap& bitmap)
      {
          QImage image = bitmap.toImage();
       
      ...
          for (y = 0; y < image.height(); ++y) {
              uchar *line = image.scanLine(y); // <<<<<<<<<<< detach here - uses non-const scanLine() when it doesn't need to.
              int w = image.width();
              uchar all = zero;
              int prev1 = -1;
              for (x = 0; x < w;) {
                  uchar byte = line[x / 8];
      

      Changing the offending line to the following should be a simple low risk fix:

              const uchar *line = image.scanLine(y);
      

      Attachments

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

        Activity

          People

            sletta Gunnar Sletta
            stevenr3 Steve Rossen
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes