diff options
author | V3n3RiX <venerix@redcorelinux.org> | 2019-04-05 21:17:31 +0100 |
---|---|---|
committer | V3n3RiX <venerix@redcorelinux.org> | 2019-04-05 21:17:31 +0100 |
commit | dc7cbdfa65fd814b3b9aa3c56257da201109e807 (patch) | |
tree | c85d72f6f31f21f178069c9d41d41a7c1ff4b362 /dev-vcs/kdesvn/files/kdesvn-2.0.0-fix-outofbounds.patch | |
parent | 0706fc6986773f4e4d391deff4ad5143c464ea4e (diff) |
gentoo resync : 05.04.2019
Diffstat (limited to 'dev-vcs/kdesvn/files/kdesvn-2.0.0-fix-outofbounds.patch')
-rw-r--r-- | dev-vcs/kdesvn/files/kdesvn-2.0.0-fix-outofbounds.patch | 99 |
1 files changed, 99 insertions, 0 deletions
diff --git a/dev-vcs/kdesvn/files/kdesvn-2.0.0-fix-outofbounds.patch b/dev-vcs/kdesvn/files/kdesvn-2.0.0-fix-outofbounds.patch new file mode 100644 index 000000000000..fa12c2db868d --- /dev/null +++ b/dev-vcs/kdesvn/files/kdesvn-2.0.0-fix-outofbounds.patch @@ -0,0 +1,99 @@ +From f87f3c9cfc5924742236bee606cc2107475968ce Mon Sep 17 00:00:00 2001 +From: David Faure <faure@kde.org> +Date: Fri, 15 Feb 2019 16:22:50 +0100 +Subject: Fix ASSERTs when calling beginRemoveRows with out of bounds + parameters. + +The last param must be the last row, not the row count. +--- + src/ksvnwidgets/models/commitmodel.cpp | 49 +++++++++++++++++++-------------- + src/svnfrontend/models/svnitemmodel.cpp | 6 ++-- + 2 files changed, 33 insertions(+), 22 deletions(-) + +diff --git a/src/ksvnwidgets/models/commitmodel.cpp b/src/ksvnwidgets/models/commitmodel.cpp +index 4b5be8a..ac9d1ff 100644 +--- a/src/ksvnwidgets/models/commitmodel.cpp ++++ b/src/ksvnwidgets/models/commitmodel.cpp +@@ -46,33 +46,42 @@ CommitModel::~CommitModel() + + void CommitModel::setCommitData(const svn::CommitItemList &aList) + { +- beginRemoveRows(QModelIndex(), 0, m_List.count()); +- m_List.clear(); +- endRemoveRows(); +- +- m_List.reserve(aList.size()); +- beginInsertRows(QModelIndex(), 0, aList.size() - 1); +- for (int j = 0; j < aList.size(); ++j) { +- m_List.append(CommitModelNodePtr(new CommitModelNode(aList[j]))); ++ if (!m_List.isEmpty()) { ++ beginRemoveRows(QModelIndex(), 0, m_List.count() - 1); ++ m_List.clear(); ++ endRemoveRows(); ++ } ++ ++ if (!aList.isEmpty()) { ++ m_List.reserve(aList.size()); ++ beginInsertRows(QModelIndex(), 0, aList.size() - 1); ++ for (int j = 0; j < aList.size(); ++j) { ++ m_List.append(CommitModelNodePtr(new CommitModelNode(aList[j]))); ++ } ++ endInsertRows(); + } +- endInsertRows(); + } + + void CommitModel::setCommitData(const CommitActionEntries &checked, const CommitActionEntries ¬checked) + { +- beginRemoveRows(QModelIndex(), 0, m_List.count()); +- m_List.clear(); +- endRemoveRows(); +- +- m_List.reserve(checked.size() + notchecked.size()); +- beginInsertRows(QModelIndex(), 0, checked.size() + notchecked.size() - 1); +- for (int j = 0; j < checked.size(); ++j) { +- m_List.append(CommitModelNodePtr(new CommitModelNode(checked[j], true))); ++ if (!m_List.isEmpty()) { ++ beginRemoveRows(QModelIndex(), 0, m_List.count() - 1); ++ m_List.clear(); ++ endRemoveRows(); + } +- for (int j = 0; j < notchecked.size(); ++j) { +- m_List.append(CommitModelNodePtr(new CommitModelNode(notchecked[j], false))); ++ ++ const int totalSize = checked.size() + notchecked.size(); ++ if (totalSize > 0) { ++ m_List.reserve(totalSize); ++ beginInsertRows(QModelIndex(), 0, totalSize - 1); ++ for (int j = 0; j < checked.size(); ++j) { ++ m_List.append(CommitModelNodePtr(new CommitModelNode(checked[j], true))); ++ } ++ for (int j = 0; j < notchecked.size(); ++j) { ++ m_List.append(CommitModelNodePtr(new CommitModelNode(notchecked[j], false))); ++ } ++ endInsertRows(); + } +- endInsertRows(); + } + + int CommitModel::ActionColumn()const +diff --git a/src/svnfrontend/models/svnitemmodel.cpp b/src/svnfrontend/models/svnitemmodel.cpp +index 0c76e50..8e99e64 100644 +--- a/src/svnfrontend/models/svnitemmodel.cpp ++++ b/src/svnfrontend/models/svnitemmodel.cpp +@@ -173,9 +173,11 @@ void SvnItemModel::setRootNodeStat(const svn::StatusPtr &stat) + void SvnItemModel::clear() + { + int numRows = m_Data->m_rootNode->childList().count(); +- beginRemoveRows(QModelIndex(), 0, numRows); ++ if (numRows > 0) ++ beginRemoveRows(QModelIndex(), 0, numRows - 1); + m_Data->clear(); +- endRemoveRows(); ++ if (numRows > 0) ++ endRemoveRows(); + } + + void SvnItemModel::beginRemoveRows(const QModelIndex &parent, int first, int last) +-- +cgit v1.1 |