diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2019-01-18 16:23:18 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2019-01-18 17:17:13 +0100 |
commit | dba14e6a75b56b75c32cb7f07a56cfc7f13112e5 (patch) | |
tree | 5858868422e9326d06963d8073b9d3b0cc0eef0b /svx | |
parent | 82913d296709ccf4d4f35d53835bcbf49286ba28 (diff) |
Ensure itemset ranges are sorted
What used to create sorted range automatically in FID_SEARCH_SEARCHSET
handler in SwView::ExecSearch, over time turned into unsorted. this
prevents using MergeRange on the sets created from the range list; see
https://ci.libreoffice.org/job/gerrit_linux_clang_dbgutil/24448/consoleFull
> svl/source/items/itemset.cxx:641:
> void SfxItemSet::MergeRange(sal_uInt16, sal_uInt16):
> Assertion `!pRange[2] || (pRange[2] > pRange[1] && pRange[2] - pRange[1] > 1)' failed.
So let's just use MergeRange in the SwView::ExecSearch itself, which
would ensure early detection if the initial list gets unsorted.
Change-Id: Id0232190f850e3feb463adfcb3153eafbaad7d9b
Reviewed-on: https://gerrit.libreoffice.org/66607
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Tested-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/dialog/srchdlg.cxx | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/svx/source/dialog/srchdlg.cxx b/svx/source/dialog/srchdlg.cxx index 91f62a0eebae..d005a1f5869a 100644 --- a/svx/source/dialog/srchdlg.cxx +++ b/svx/source/dialog/srchdlg.cxx @@ -1999,23 +1999,14 @@ IMPL_LINK_NOARG(SvxSearchDialog, FormatHdl_Impl, Button*, void) if ( !pSh || !pImpl->pRanges ) return; - std::vector<sal_uInt16> aWhRanges; - - const sal_uInt16* pPtr = pImpl->pRanges.get(); - while (*pPtr) - { - aWhRanges.push_back(*pPtr++); - } + SfxItemPool& rPool = pSh->GetPool(); + SfxItemSet aSet(rPool, pImpl->pRanges.get()); - aWhRanges.push_back(SID_ATTR_PARA_MODEL); - aWhRanges.push_back(SID_ATTR_PARA_MODEL); + aSet.MergeRange(SID_ATTR_PARA_MODEL, SID_ATTR_PARA_MODEL); sal_uInt16 nBrushWhich = pSh->GetPool().GetWhich(SID_ATTR_BRUSH); - aWhRanges.push_back(nBrushWhich); - aWhRanges.push_back(nBrushWhich); - aWhRanges.push_back(0); - SfxItemPool& rPool = pSh->GetPool(); - SfxItemSet aSet(rPool, aWhRanges.data()); + aSet.MergeRange(nBrushWhich, nBrushWhich); + OUString aTxt; aSet.InvalidateAllItems(); |