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

QGraphicsScene::clearSelection() may leave internal state inconsistent

    XMLWordPrintable

Details

    • All
    • 2e12479e06 (qt/qtbase/dev) 2e12479e06 (qt/tqtc-qtbase/dev) a31e0e4189 (qt/qtbase/6.4) 941a623307 (qt/qtbase/6.3) 941a623307 (qt/tqtc-qtbase/6.3) a31e0e4189 (qt/tqtc-qtbase/6.4) 48c842ce3d (qt/tqtc-qtbase/6.2)

    Description

      The current implementatation of QGraphicsScene::clearSelection() has a flaw: QGraphicsItems can override setSelected() with the itemChanged() function. This is not taken into account where the internal state is modified after setSelected( false ) has been called on all items:

      foreach (QGraphicsItem *item, d->selectedItems)
          item->setSelected(false);
      d->selectedItems.clear(); // <- items may still be selected here

      So instead of just clearing the vector, it is required to determine the actually selected items.

      Attachments

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

        Activity

          People

            vhilshei Volker Hilsheimer
            thippler Tobias Hippler
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews