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

QGraphicsScene crash on clear and adding existing QGraphicsItem.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Out of scope
    • Not Evaluated
    • None
    • 4.8.1
    • Widgets: GraphicsView
    • None
    • Windows 7-64, Qt for Desktop 4.8.1

    Description

      Application crash by calling QGraphicsScene::clear() method and re adding existing item:

      MyClass::MyClass() {
          scene = new QGraphicsScene(...);
          item = new MyGraphicsItem();
          scene->addItem(item);
      }
      ...
      void MyClass::f() {
          scene->clear();
          scene->addItem(item);
      }
      

      by adding QGraphicsScene::removeItem(item) before ::clear() seems to solve issue:

      void MyClass::f() {
          scene->removeItem(item);
          scene->clear();
          scene->addItem(item);
      }
      

      Same behavior by trying to add existing item two times.

      Also, suggestion to add method that checks for item existence in QGraphicsScene.

      Attachments

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

        Activity

          People

            aksalova Akseli Salovaara
            dmitrijs.z Dmitrijs
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes