svx/source/svdraw/svdpage.cxx | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-)
New commits: commit 5727f7262d48864ec27aa190631284af7d2a7ce8 Author: Katarina Behrens <katarina.behr...@cib.de> AuthorDate: Wed Oct 30 14:32:17 2019 +0100 Commit: Michael Stahl <michael.st...@cib.de> CommitDate: Fri Nov 1 10:30:09 2019 +0100 crashtesting: fix creating increments array in tdf106848-1.odt else duplicate indexes happen and sort algorithm falls flat on its face Change-Id: I2b79e8df0f0a8e68117029630c0e026b8c202b02 Reviewed-on: https://gerrit.libreoffice.org/81775 Reviewed-by: Michael Stahl <michael.st...@cib.de> Tested-by: Jenkins diff --git a/svx/source/svdraw/svdpage.cxx b/svx/source/svdraw/svdpage.cxx index a6cef0633542..ea99495edc24 100644 --- a/svx/source/svdraw/svdpage.cxx +++ b/svx/source/svdraw/svdpage.cxx @@ -627,29 +627,25 @@ void SdrObjList::sort( std::vector<sal_Int32>& sortOrder) // example aShapesWithTextbox [0 2] } - aIncrements.push_back(0); - aDuplicates.push_back(sortOrder[0]); + for (size_t i = 0; i< sortOrder.size(); ++i) + { - // corner case: 1st shape is a textbox, add it twice - // otherwise sortOrder loop below will skip it - if (aShapesWithTextbox.count(sortOrder[0]) > 0) - aDuplicates.push_back(sortOrder[0]); + if (aShapesWithTextbox.count(sortOrder[i]) > 0) + aDuplicates.push_back(sortOrder[i]); - for (size_t i = 1; i< sortOrder.size(); ++i) - { aDuplicates.push_back(sortOrder[i]); - if (aShapesWithTextbox.count(sortOrder[i]) > 0) - { + // example aDuplicates [2 2 0 0 1] + } + + aIncrements.push_back(0); + for (size_t i = 1; i< sortOrder.size(); ++i) + { + if (aShapesWithTextbox.count(i)) aIncrements.push_back(aIncrements[i-1] + 1 ); - aDuplicates.push_back(sortOrder[i]); - } else - { aIncrements.push_back(aIncrements[i-1]); - } - // example aDuplicates [2 2 0 0 1] // example aIncrements [0 1 1] } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits