From 74fdd584866c8326678877e4ac47ab9df1a3f635 Mon Sep 17 00:00:00 2001 From: Julien Nabet Date: Thu, 25 Jul 2024 10:27:31 +0200 Subject: tdf#162174: fix crash when opening Bullets and Numbering dialog a second time It seems we must first retrieve the array of values from: - officecfg::Office::Common::BulletsNumbering::DefaultBullets - officecfg::Office::Common::BulletsNumbering::DefaultBulletsFonts before retrieving the value by index. Change-Id: I9cdf124f73c52f3027ae8e97a73e01e0efb73603 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171003 Tested-by: Jenkins Reviewed-by: Julien Nabet --- cui/source/tabpages/numpages.cxx | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/cui/source/tabpages/numpages.cxx b/cui/source/tabpages/numpages.cxx index 211bb3f550a2..9311ab96559c 100644 --- a/cui/source/tabpages/numpages.cxx +++ b/cui/source/tabpages/numpages.cxx @@ -338,6 +338,8 @@ SvxBulletPickTabPage::SvxBulletPickTabPage(weld::Container* pPage, weld::DialogC m_xExamplesVS->SetSelectHdl(LINK(this, SvxBulletPickTabPage, NumSelectHdl_Impl)); m_xExamplesVS->SetDoubleClickHdl(LINK(this, SvxBulletPickTabPage, DoubleClickHdl_Impl)); m_xBtChangeBullet->connect_clicked(LINK(this, SvxBulletPickTabPage, ClickAddChangeHdl_Impl)); + m_aBulletSymbols = officecfg::Office::Common::BulletsNumbering::DefaultBullets::get(); + m_aBulletSymbolsFonts = officecfg::Office::Common::BulletsNumbering::DefaultBulletsFonts::get(); } SvxBulletPickTabPage::~SvxBulletPickTabPage() @@ -443,10 +445,9 @@ IMPL_LINK_NOARG(SvxBulletPickTabPage, NumSelectHdl_Impl, ValueSet*, void) bPreset = false; bModified = true; sal_uInt16 nIndex = m_xExamplesVS->GetSelectedItemId() - 1; - sal_Unicode cChar = officecfg::Office::Common::BulletsNumbering::DefaultBullets::get()[nIndex].toChar(); + sal_Unicode cChar = m_aBulletSymbols[nIndex].toChar(); vcl::Font& rActBulletFont = lcl_GetDefaultBulletFont(); - rActBulletFont.SetFamilyName( - officecfg::Office::Common::BulletsNumbering::DefaultBulletsFonts::get()[nIndex]); + rActBulletFont.SetFamilyName(m_aBulletSymbolsFonts[nIndex]); sal_uInt16 nMask = 1; for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++) @@ -527,8 +528,6 @@ IMPL_LINK_NOARG(SvxBulletPickTabPage, ClickAddChangeHdl_Impl, weld::Button&, voi _nMask <<= 1; } - m_aBulletSymbols = officecfg::Office::Common::BulletsNumbering::DefaultBullets::get(); - m_aBulletSymbolsFonts = officecfg::Office::Common::BulletsNumbering::DefaultBulletsFonts::get(); css::uno::Sequence aBulletSymbolsList(m_aBulletSymbols.size()); css::uno::Sequence aBulletSymbolsFontsList(m_aBulletSymbolsFonts.size()); auto aBulletSymbolsListRange = asNonConstRange(aBulletSymbolsList); -- cgit