sc/source/filter/inc/condformatbuffer.hxx | 1 + sc/source/filter/oox/condformatbuffer.cxx | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-)
New commits: commit 682e3f931180fdc5652fe89ea88f7474f6ace84c Author: Caolán McNamara <caolan.mcnam...@collabora.com> AuthorDate: Mon Jan 15 20:41:49 2024 +0000 Commit: Dennis Francis <dennis.fran...@collabora.com> CommitDate: Tue Jan 23 03:50:41 2024 +0100 ofz#65809 Direct-leak since: commit c84a1928ea76cf175711942db9ca7bb2f0ec6f0b Date: Tue Oct 3 12:40:25 2023 +0530 sc: condfmt-perf: use a shared cache that... mbReadyForFinalize gets set to true, but the mpFormat is never set into the ScDocument, add a mbOwnsFormat to track successful transfer of ownership. Change-Id: I8f11c68a4253d1ad67ec96825d5036ad468562ff Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162136 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Dennis Francis <dennis.fran...@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162392 Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> Tested-by: Dennis Francis <dennis.fran...@collabora.com> diff --git a/sc/source/filter/inc/condformatbuffer.hxx b/sc/source/filter/inc/condformatbuffer.hxx index 9c8896dbf22a..945a05d99e94 100644 --- a/sc/source/filter/inc/condformatbuffer.hxx +++ b/sc/source/filter/inc/condformatbuffer.hxx @@ -232,6 +232,7 @@ private: CondFormatRuleMap maRules; /// Maps formatting rules by priority. ScConditionalFormat* mpFormat; bool mbReadyForFinalize; + bool mbOwnsFormat; }; struct ExCfRuleModel diff --git a/sc/source/filter/oox/condformatbuffer.cxx b/sc/source/filter/oox/condformatbuffer.cxx index 649c2417f348..ebfe88ce8da6 100644 --- a/sc/source/filter/oox/condformatbuffer.cxx +++ b/sc/source/filter/oox/condformatbuffer.cxx @@ -1095,13 +1095,14 @@ CondFormatModel::CondFormatModel() : CondFormat::CondFormat( const WorksheetHelper& rHelper ) : WorksheetHelper( rHelper ), mpFormat(nullptr), - mbReadyForFinalize(false) + mbReadyForFinalize(false), + mbOwnsFormat(true) { } CondFormat::~CondFormat() { - if (!mbReadyForFinalize && mpFormat) + if (mbOwnsFormat) delete mpFormat; } @@ -1147,12 +1148,11 @@ void CondFormat::finalizeImport() if (mpFormat->size() > 0) { SCTAB nTab = maModel.maRanges.GetTopLeftCorner().Tab(); + mbOwnsFormat = false; // ownership transferred to std::unique_ptr -> ScDocument sal_Int32 nIndex = getScDocument().AddCondFormat(std::unique_ptr<ScConditionalFormat>(mpFormat), nTab); rDoc.AddCondFormatData( maModel.maRanges, nTab, nIndex ); } - else - mbReadyForFinalize = false; } CondFormatRuleRef CondFormat::createRule()