diff options
author | Katarina Behrens <Katarina.Behrens@cib.de> | 2019-10-30 14:32:17 +0100 |
---|---|---|
committer | Michael Stahl <michael.stahl@cib.de> | 2019-11-01 10:30:09 +0100 |
commit | 5727f7262d48864ec27aa190631284af7d2a7ce8 (patch) | |
tree | 0e4a3dc0d18be8d70dbef359c890db01bf1f8a27 /svx | |
parent | ab3ec039bf5ffc1fb6f6948c1a1a7da2acad30eb (diff) |
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.stahl@cib.de>
Tested-by: Jenkins
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/svdraw/svdpage.cxx | 26 |
1 files changed, 11 insertions, 15 deletions
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] } |