ahmadsamir created this revision. ahmadsamir added a reviewer: mlaurent. Herald added a project: Plasma. Herald added a subscriber: plasma-devel. ahmadsamir requested review of this revision.
REVISION 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 REPOSITORY R103 KMenu Editor BRANCH ahmad/takechildren-crash-on-index-rootItem (branched from master) REVISION DETAIL https://phabricator.kde.org/D24615 AFFECTED FILES treeview.cpp To: ahmadsamir, mlaurent Cc: plasma-devel, LeGast00n, The-Feren-OS-Dev, jraleigh, fbampaloukas, GB_2, ragreen, ZrenBot, ngraham, alexeymin, himcesjf, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, ahiemstra, mart