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

Accidental detach in qt_bitmapToRegion

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3: Somewhat important
    • Resolution: Done
    • Affects Version/s: 5.6.0
    • Fix Version/s: 5.6.1
    • Component/s: GUI: Painting
    • Labels:
      None
    • Commits:
      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

            Assignee:
            sletta Gunnar Sletta
            Reporter:
            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