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

QTableView:1638 ASSERT failure in QBitArray::QBitArray: "Size must be greater than or equal to 0.",

    XMLWordPrintable

Details

    • Bug
    • Resolution: Cannot Reproduce
    • P2: Important
    • None
    • 5.9.1
    • Widgets: Itemviews
    • None

    Description

      Hello. I got this error

      ASSERT failure in QBitArray::QBitArray: "Size must be greater than or equal to 0.", file tools\qbitarray.cpp, line 150

      It's happening when I'm removing items from my model. First model full with elements, after I removed them and I have only 3 items I have this bug.

      File QTableView:1368

      //firstVisualRow is the visual index of the first visible row.  lastVisualRow is the visual index of the last visible Row.
      //same goes for ...VisualColumn
      int firstVisualRow = qMax(verticalHeader->visualIndexAt(0),0);
      int lastVisualRow = verticalHeader->visualIndexAt(verticalHeader->viewport()->height());
      if (lastVisualRow == -1)
          lastVisualRow = d->model->rowCount(d->root) - 1;

      int firstVisualColumn = horizontalHeader->visualIndexAt(0);
      int lastVisualColumn = horizontalHeader->visualIndexAt(horizontalHeader->viewport()->width());
      if (rightToLeft)
          qSwap(firstVisualColumn, lastVisualColumn);
      if (firstVisualColumn == -1)
          firstVisualColumn = 0;
      if (lastVisualColumn == -1)
          lastVisualColumn = horizontalHeader->count() - 1;

          QBitArray drawn((lastVisualRow - firstVisualRow + 1) * (lastVisualColumn - firstVisualColumn + 1))

      Variable values:

      firstVisualRow = 53
      lastVisualRow = 3

      firstVisualColumn = 0
      lastVisualColumn = 5

      (lastVisualRow - firstVisualRow + 1) * (lastVisualColumn - firstVisualColumn + 1) = (3 - 53 + 1) * (5 - 0 + 1) = -294

      File QBitArray:147
      QBitArray::QBitArray(int size, bool value)
          : d(size <= 0 ? 0 : 1 + (size + 7)/8, Qt::Uninitialized)
      {{{}}
          Q_ASSERT_X(size >= 0, "QBitArray::QBitArray", "Size must be greater than or equal to 0.");
          if (size <= 0)
              return;

      Attachments

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

        Activity

          People

            chehrlic Christian Ehrlicher
            dlodyakov Dmitry Lodyakov
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes