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

Crash in QML ListView when removing all items, last first

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P1: Critical
    • 5.4.2
    • 5.0.2, 5.2.0 Beta1 , 5.2.0 RC1, 5.3.2
    • None
    • Win 7 + MSVC2012 OpenGL, Ubuntu 14.04
    • 5df747fc5300f9c7e1da0fb86bab68209c921c9c

    Description

      The Segmentation fault occurs when removing all items last first, and have an state change property transition dependent on the delegate index.

      Test code is below. Please not that just reproduces the issue and doesn't represent the exact code I'm experiencing problems with.

      import QtQuick 2.0
      
      Rectangle {
          id: top
          width: 200
          height: 500
      
          ListModel {
              id: listModel
              ListElement { name: "test1" }
              ListElement { name: "test2" }
          }
      
          Timer {
              interval: 2000
              repeat: false
              running: true
      
              onTriggered: {
                  listModel.remove(1)
                  listModel.remove(0)
              }
          }
      
          ListView {
              id: lv
              model: listModel
              anchors.fill: parent
              orientation: ListView.Vertical
              spacing: 5
      
              delegate: Rectangle {
                  id: delegateItem
                  color: "red"
      
                  anchors {
                      left: parent.left
                      right: parent.right
                  }
      
                  property bool menuSelected: lv.currentIndex === index
      
                  property real collapsedHeight: 30
                  height: collapsedHeight
      
                  states: State {
                      name: "expanded"
                      when: menuSelected
      
                      PropertyChanges {
                          target: delegateItem
                          height: 60
                      }
                  }
      
                  MouseArea {
                      anchors.fill: parent
                      onClicked: lv.currentIndex = index
                  }
      
                  transitions: Transition {
                      NumberAnimation {
                          properties: "height"
                      }
                  }
              }
          }
      }
      

      Attachments

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

        Activity

          People

            aalpert Alan Alpert
            dednick Nick Dedekind
            Votes:
            3 Vote for this issue
            Watchers:
            12 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes