diff options
author | Oliver Specht <oliver.specht@cib.de> | 2024-03-19 13:16:07 +0100 |
---|---|---|
committer | Gabor Kelemen <gabor.kelemen.extern@allotropia.de> | 2024-03-25 16:59:06 +0100 |
commit | 203b6a00cf5b716cb580d2bd4e9a6071cec23574 (patch) | |
tree | 03e07b76e822f429fe71e524051301faac3f9135 /svx | |
parent | 4a14bad7232ecf23d23c1997dc20922d0b4892cb (diff) |
tdf#160264 Fixed crash in gallery
Local gallery themes need an additional listener to prevent deleting
the global theme.
Change-Id: If6cfcb5a3eeffdc087b089f2151c45b2cff87bbd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165029
Tested-by: Jenkins
Tested-by: Gabor Kelemen <gabor.kelemen.extern@allotropia.de>
Reviewed-by: Gabor Kelemen <gabor.kelemen.extern@allotropia.de>
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/gallery2/galbrws1.cxx | 25 | ||||
-rw-r--r-- | svx/source/inc/galbrws1.hxx | 1 |
2 files changed, 13 insertions, 13 deletions
diff --git a/svx/source/gallery2/galbrws1.cxx b/svx/source/gallery2/galbrws1.cxx index c68c2d8ba83e..443d9be4adec 100644 --- a/svx/source/gallery2/galbrws1.cxx +++ b/svx/source/gallery2/galbrws1.cxx @@ -256,7 +256,7 @@ void GalleryBrowser1::ImplFillExchangeData( const GalleryTheme* pThm, ExchangeDa void GalleryBrowser1::ImplGetExecuteVector(std::vector<OUString>& o_aExec) { - GalleryTheme* pTheme = mpGallery->AcquireTheme( GetSelectedTheme(), *this ); + GalleryTheme* pTheme = mpGallery->AcquireTheme( GetSelectedTheme(), maLocalListner ); if( !pTheme ) return; @@ -288,14 +288,14 @@ void GalleryBrowser1::ImplGetExecuteVector(std::vector<OUString>& o_aExec) o_aExec.emplace_back("properties"); - mpGallery->ReleaseTheme( pTheme, *this ); + mpGallery->ReleaseTheme( pTheme, maLocalListner ); } void GalleryBrowser1::ImplGalleryThemeProperties( std::u16string_view rThemeName, bool bCreateNew ) { DBG_ASSERT(!mpThemePropsDlgItemSet, "mpThemePropsDlgItemSet already set!"); mpThemePropsDlgItemSet.reset(new SfxItemSet( SfxGetpApp()->GetPool() )); - GalleryTheme* pTheme = mpGallery->AcquireTheme( rThemeName, *this ); + GalleryTheme* pTheme = mpGallery->AcquireTheme( rThemeName, maLocalListner ); ImplFillExchangeData( pTheme, *mpExchangeData ); @@ -345,7 +345,7 @@ void GalleryBrowser1::ImplEndGalleryThemeProperties(bool bCreateNew, sal_Int32 n } OUString aThemeName( mpExchangeData->pTheme->GetName() ); - mpGallery->ReleaseTheme( mpExchangeData->pTheme, *this ); + mpGallery->ReleaseTheme( mpExchangeData->pTheme, maLocalListner ); if ( bCreateNew && ( nRet != RET_OK ) ) { @@ -367,13 +367,13 @@ void GalleryBrowser1::ImplExecute(std::u16string_view rIdent) { if (rIdent == u"update") { - GalleryTheme* pTheme = mpGallery->AcquireTheme( GetSelectedTheme(), *this ); + GalleryTheme* pTheme = mpGallery->AcquireTheme( GetSelectedTheme(), maLocalListner ); SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); ScopedVclPtr<VclAbstractDialog> aActualizeProgress(pFact->CreateActualizeProgressDialog(mxThemes.get(), pTheme)); aActualizeProgress->Execute(); - mpGallery->ReleaseTheme( pTheme, *this ); + mpGallery->ReleaseTheme( pTheme, maLocalListner ); } else if (rIdent == u"delete") { @@ -384,7 +384,7 @@ void GalleryBrowser1::ImplExecute(std::u16string_view rIdent) } else if (rIdent == u"rename") { - GalleryTheme* pTheme = mpGallery->AcquireTheme( GetSelectedTheme(), *this ); + GalleryTheme* pTheme = mpGallery->AcquireTheme( GetSelectedTheme(), maLocalListner ); const OUString aOldName( pTheme->GetName() ); SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); @@ -407,11 +407,11 @@ void GalleryBrowser1::ImplExecute(std::u16string_view rIdent) mpGallery->RenameTheme( aOldName, aName ); } } - mpGallery->ReleaseTheme( pTheme, *this ); + mpGallery->ReleaseTheme( pTheme, maLocalListner ); } else if (rIdent == u"assign") { - GalleryTheme* pTheme = mpGallery->AcquireTheme( GetSelectedTheme(), *this ); + GalleryTheme* pTheme = mpGallery->AcquireTheme( GetSelectedTheme(), maLocalListner ); if (pTheme && !pTheme->IsReadOnly()) { @@ -422,7 +422,7 @@ void GalleryBrowser1::ImplExecute(std::u16string_view rIdent) pTheme->SetId( aDlg->GetId(), true ); } - mpGallery->ReleaseTheme( pTheme, *this ); + mpGallery->ReleaseTheme( pTheme, maLocalListner ); } else if (rIdent == u"properties") { @@ -1500,13 +1500,12 @@ IMPL_LINK(GalleryBrowser1, SelectTbxHdl, weld::Toggleable&, rBox, void) void GalleryBrowser1::FillThemeEntries() { - SfxListener aListener; for (size_t i = 0, nCount = mpGallery->GetThemeCount(); i < nCount; ++i) { const GalleryThemeEntry* pThemeInfo = mpGallery->GetThemeInfo( i ); OUString aThemeName = pThemeInfo->GetThemeName(); //sal_uInt32 nId = pThemeInfo->GetId(); - GalleryTheme* pTheme = mpGallery->AcquireTheme(aThemeName, aListener); + GalleryTheme* pTheme = mpGallery->AcquireTheme(aThemeName, maLocalListner); sal_uInt32 nObjectCount = pTheme->GetObjectCount(); for (size_t nObject = 0; nObject < nObjectCount; ++nObject) { @@ -1514,7 +1513,7 @@ void GalleryBrowser1::FillThemeEntries() OUString aTitle = GetItemText(*xSgaObject, GalleryItemFlags::Title); maAllThemeEntries.push_back(ThemeEntry(aThemeName, aTitle, nObject)); } - mpGallery->ReleaseTheme(pTheme, aListener); + mpGallery->ReleaseTheme(pTheme, maLocalListner); } maFoundThemeEntries.assign(maAllThemeEntries.begin(), maAllThemeEntries.end()); } diff --git a/svx/source/inc/galbrws1.hxx b/svx/source/inc/galbrws1.hxx index 5f9988b9148c..50cffa1ddd7b 100644 --- a/svx/source/inc/galbrws1.hxx +++ b/svx/source/inc/galbrws1.hxx @@ -135,6 +135,7 @@ private: css::uno::Reference<css::util::XURLTransformer> m_xTransformer; CharClass m_aCharacterClassficator; + SfxListener maLocalListner; void ImplInsertThemeEntry(const GalleryThemeEntry* pEntry); static void ImplFillExchangeData(const GalleryTheme* pThm, ExchangeData& rData); |