Fix crash with sortAllByName/Description

Authored by ahmadsamir on Oct 13 2019, 4:39 PM.

Description

Fix crash with sortAllByName/Description

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

Details

Committed
ahmadsamirOct 14 2019, 10:57 AM
Reviewer
mlaurent
Differential Revision
D24615: Fix crash with sortAllByName/Description
Parents
R103:3784ba131541: Fix Bug 412587 - [Crash] Kde Menu Editor
Branches
Unknown
Tags
Unknown