Skip to content
  • Ahmad Samir's avatar
    Fix crash with sortAllByName/Description · 3d4640be
    Ahmad Samir authored
    Summary:
    Calling QTreeWidgetItem::takeChildren() on invisibleRootItem() results
    in a crash because it calls QTreeModel::beginRemoveItems() which calls
    QTreeModel::index() on that item which returns an invalid QModelIndex.
    
    Instead iterate over topLevelItem's and sort them.
    
    Test Plan:
    - Sort all by name/description causes a crash
    - Apply the patch then try again, it should work
    
    Reviewers: mlaurent
    
    Reviewed By: mlaurent
    
    Subscribers: plasma-devel
    
    Tags: #plasma
    
    Differential Revision: https://phabricator.kde.org/D24615
    3d4640be