sc/source/core/data/poolhelp.cxx | 4 ++-- sc/source/core/inc/poolhelp.hxx | 1 - 2 files changed, 2 insertions(+), 3 deletions(-)
New commits: commit e71080e19365aa074c56d1136dad2b09783949a2 Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Thu Feb 16 13:53:14 2023 +0300 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Thu Feb 16 12:02:24 2023 +0000 Avoid storing a redundant reference that may become dangling It would be dangling after ScPoolHelper::SourceDocumentGone. The pointer to the document is stored in the pool, anyway. Change-Id: I10f8f2808b8dc895f85a92f7bcf4dc44516c44a0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147148 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> diff --git a/sc/source/core/data/poolhelp.cxx b/sc/source/core/data/poolhelp.cxx index 6ed855fc7a51..64978eb2d5a2 100644 --- a/sc/source/core/data/poolhelp.cxx +++ b/sc/source/core/data/poolhelp.cxx @@ -29,7 +29,6 @@ ScPoolHelper::ScPoolHelper( ScDocument& rSourceDoc ) : pDocPool(new ScDocumentPool) - , m_rSourceDoc(rSourceDoc) { pDocPool->FreezeIdRanges(); @@ -95,7 +94,8 @@ std::unique_ptr<SvNumberFormatter> ScPoolHelper::CreateNumberFormatter() const std::scoped_lock aGuard(maMtxCreateNumFormatter); p.reset(new SvNumberFormatter(comphelper::getProcessComponentContext(), LANGUAGE_SYSTEM)); } - p->SetColorLink( LINK(&m_rSourceDoc, ScDocument, GetUserDefinedColor) ); + assert(mxStylePool->GetDocument()); + p->SetColorLink( LINK(mxStylePool->GetDocument(), ScDocument, GetUserDefinedColor)); p->SetEvalDateFormat(NF_EVALDATEFORMAT_INTL_FORMAT); sal_uInt16 d,m; diff --git a/sc/source/core/inc/poolhelp.hxx b/sc/source/core/inc/poolhelp.hxx index ed1275da5ac9..860e1b3a8b2f 100644 --- a/sc/source/core/inc/poolhelp.hxx +++ b/sc/source/core/inc/poolhelp.hxx @@ -41,7 +41,6 @@ private: mutable std::unique_ptr<SvNumberFormatter> pFormTable; mutable rtl::Reference<SfxItemPool> pEditPool; // EditTextObjectPool mutable rtl::Reference<SfxItemPool> pEnginePool; // EditEnginePool - ScDocument& m_rSourceDoc; public: ScPoolHelper( ScDocument& rSourceDoc );