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

Deleting QGraphicsItem with QGraphicsEffect leads to segfault on redraw

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 5.7.1, 5.15.9
    • GUI: Painting
    • None
    • Debian, GCC 6.2.1, Qt 5.7.1

    Description

      The attached example program paints a red background in the left upper corner. On left mouse click it paints a white rectangle with a shadow. On right click the white rectangle disappears.

      Sometimes a right click leads to segfault.

      A possible workaround seems to be to call `prepareGeometryChange()` on the `QGraphicsItem` that has the `QGraphicsEffect` before removing that item from the scene.

      See also here: https://forum.qt.io/topic/75510/deleting-qgraphicsitem-with-qgraphicseffect-leads-to-segfault/13

      Edit: The problem does only appear if the item with `QGraphicsEffect` is removed (`QGraphicsScene::removeItem()`) before it is deleted. If the item is simply deleted (which implies removal from the scene) but without the explicit call to QGraphicsScene::removeItem() before, the segfault does not occur.

      I believe this could make it relatively easy to identify the cause of the problem.

      Attachments

        1. backtrace
          4 kB
        2. Main.cc
          2 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            sletta Gunnar Sletta
            tfm123 Ole
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes