summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2021-04-28 12:37:19 +0200
committerMichael Stahl <michael.stahl@allotropia.de>2021-04-29 11:38:57 +0200
commitb672adaf5a4604aa09322034e4f5c151a4dc1314 (patch)
tree93fbc9dc344e9f5001250d3e30beb799af79f789 /sfx2
parenta559e6e6574b84c061fb5a90291276819f3b0c33 (diff)
tdf#135997: make sure that the two lists are same length
This fixes the strange assumption that when searching the two lists (character names and font names) independently, the two found positions will necessarily correspond to each other. Instead, the positions of the match must be the same, which is implemented now. Also the input from configuration is sanitized. Change-Id: I920de7414387e181e11183b8a22776a72b6be419 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114722 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> (cherry picked from commit b6ab5914d8b2fc7041430796890f086f8e3e6369) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114852 Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/control/charmapcontrol.cxx13
1 files changed, 13 insertions, 0 deletions
diff --git a/sfx2/source/control/charmapcontrol.cxx b/sfx2/source/control/charmapcontrol.cxx
index ce580f1618b7..c2175718fca8 100644
--- a/sfx2/source/control/charmapcontrol.cxx
+++ b/sfx2/source/control/charmapcontrol.cxx
@@ -122,10 +122,17 @@ void SfxCharmapCtrl::getFavCharacterList()
//retrieve recent character font list
css::uno::Sequence< OUString > rFavCharFontList( officecfg::Office::Common::FavoriteCharacters::FavoriteCharacterFontList::get() );
m_aFavCharFontList.insert( m_aFavCharFontList.end(), rFavCharFontList.begin(), rFavCharFontList.end() );
+
+ // tdf#135997: make sure that the two lists are same length
+ const auto nCommonLength = std::min(m_aFavCharList.size(), m_aFavCharFontList.size());
+ m_aFavCharList.resize(nCommonLength);
+ m_aFavCharFontList.resize(nCommonLength);
}
void SfxCharmapCtrl::updateFavCharControl()
{
+ assert(m_aFavCharList.size() == m_aFavCharFontList.size());
+
int i = 0;
for ( std::deque< OUString >::iterator it = m_aFavCharList.begin(), it2 = m_aFavCharFontList.begin();
it != m_aFavCharList.end() && it2 != m_aFavCharFontList.end();
@@ -154,10 +161,16 @@ void SfxCharmapCtrl::getRecentCharacterList()
//retrieve recent character font list
css::uno::Sequence< OUString > rRecentCharFontList( officecfg::Office::Common::RecentCharacters::RecentCharacterFontList::get() );
m_aRecentCharFontList.insert( m_aRecentCharFontList.end(), rRecentCharFontList.begin(), rRecentCharFontList.end() );
+
+ // tdf#135997: make sure that the two lists are same length
+ const auto nCommonLength = std::min(m_aRecentCharList.size(), m_aRecentCharFontList.size());
+ m_aRecentCharList.resize(nCommonLength);
+ m_aRecentCharFontList.resize(nCommonLength);
}
void SfxCharmapCtrl::updateRecentCharControl()
{
+ assert(m_aRecentCharList.size() == m_aRecentCharFontList.size());
int i = 0;
for ( std::deque< OUString >::iterator it = m_aRecentCharList.begin(), it2 = m_aRecentCharFontList.begin();
it != m_aRecentCharList.end() && it2 != m_aRecentCharFontList.end();