From e384f2e8de9603c0e10bed9e35f26be08c0ca86c Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Mon, 10 Mar 2025 14:45:22 +0000 Subject: crashtesting: crash on reimport of xlsx output of forum-pl-2758.ods MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit also seen as a leak as nothing is erased by: maRegisteredCellAttributes.erase(&rCandidate); once the style names are changed and the std::set isn't ordered according to its predicate anymore. Easiest thing to do here seems to run the rename of a cell style through CellAttributeHelper so it can reinsert the affected ScPatternAttrs Change-Id: I13486701f378228792baa2b378709b7d530c3770 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182743 Reviewed-by: Caolán McNamara Tested-by: Jenkins --- sc/inc/patattr.hxx | 1 + sc/inc/stlpool.hxx | 3 +++ 2 files changed, 4 insertions(+) (limited to 'sc/inc') diff --git a/sc/inc/patattr.hxx b/sc/inc/patattr.hxx index b75ee42e64f3..70e72ba403e6 100644 --- a/sc/inc/patattr.hxx +++ b/sc/inc/patattr.hxx @@ -92,6 +92,7 @@ public: void CellStyleDeleted(const ScStyleSheet& rStyle); void CellStyleCreated(ScDocument& rDoc, const OUString& rName); + void RenameCellStyle(ScStyleSheet& rStyle, const OUString& rNewName); void UpdateAllStyleSheets(ScDocument& rDoc); void AllStylesToNames(); void ReIndexRegistered(); diff --git a/sc/inc/stlpool.hxx b/sc/inc/stlpool.hxx index 206ec79dc507..6d62affe7b71 100644 --- a/sc/inc/stlpool.hxx +++ b/sc/inc/stlpool.hxx @@ -56,6 +56,9 @@ public: // Finds Para style with given name case-insensitively, or STR_STYLENAME_STANDARD ScStyleSheet* FindAutoStyle(const OUString& rName); + // Rename rStyle to rNewName, and update CellAttribute holder + SC_DLLPUBLIC void Rename(SfxStyleSheetBase& rStyle, const OUString& rNewName, SfxStyleFamily eFam); + SC_DLLPUBLIC virtual SfxStyleSheetBase& Make( const OUString&, SfxStyleFamily eFam, SfxStyleSearchBits nMask = SfxStyleSearchBits::All, const OUString& rParentStyleSheetName = u""_ustr) override; -- cgit