Commit f5ac44ef authored by con's avatar con
Browse files

Fix crash under certain conditions when renaming tool categories.

Task-number: QTCREATORBUG-3916
parent a87a8e71
......@@ -252,8 +252,11 @@ bool ExternalToolModel::setData(const QModelIndex &modelIndex, const QVariant &v
categories.append(string);
qSort(categories);
int newIndex = categories.indexOf(string);
if (newIndex != previousIndex)
beginMoveRows(QModelIndex(), previousIndex, previousIndex, QModelIndex(), newIndex);
if (newIndex != previousIndex) {
// we have same parent so we have to do special stuff for beginMoveRows...
int beginMoveRowsSpecialIndex = (previousIndex < newIndex ? newIndex + 1 : newIndex);
beginMoveRows(QModelIndex(), previousIndex, previousIndex, QModelIndex(), beginMoveRowsSpecialIndex);
}
QList<ExternalTool *> items = m_tools.take(category);
m_tools.insert(string, items);
if (newIndex != previousIndex)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment