diff options
author | Caolán McNamara <caolan.mcnamara@collabora.com> | 2024-12-28 20:09:35 +0000 |
---|---|---|
committer | Caolán McNamara <caolan.mcnamara@collabora.com> | 2024-12-28 22:13:40 +0100 |
commit | 960db01dbfe2f916b91782da03532fae1f836445 (patch) | |
tree | 346a5d12d91b9e3c1275c25e89e8ae5eaff79ac9 | |
parent | d6f741ccb093eb7cce673d7789fedd4642772311 (diff) |
Resolves: tdf#164463 we need to pass a copy of the LayoutName
a reference means it can get updated to rName during the function and
the comparisons fail.
a problem since:
commit 235c230cd348600ce7385cc580c45a7be3572704
CommitDate: Tue Oct 22 09:17:02 2024 +0200
We don't need a virtual here
Change-Id: I2f4e19ffb21b56f3554837d700977bde45140e42
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/179494
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Tested-by: Jenkins
-rw-r--r-- | sd/source/core/drawdoc3.cxx | 5 | ||||
-rw-r--r-- | sd/source/ui/unoidl/unopage.cxx | 7 | ||||
-rw-r--r-- | sd/source/ui/view/drviewsb.cxx | 3 |
3 files changed, 10 insertions, 5 deletions
diff --git a/sd/source/core/drawdoc3.cxx b/sd/source/core/drawdoc3.cxx index 5df9ea0d7dfd..f04e56712940 100644 --- a/sd/source/core/drawdoc3.cxx +++ b/sd/source/core/drawdoc3.cxx @@ -106,10 +106,9 @@ void InsertBookmarkAsPage_FindDuplicateLayouts::operator()( SdDrawDocument& rDoc // about this if( bRenameDuplicates && aTest != SdResId( STR_LAYOUT_DEFAULT_NAME ) && !(pTestPage->Equals(*pBMMPage)) ) { - pBookmarkDoc->RenameLayoutTemplate( - pBMMPage->GetLayoutName(), pBMMPage->GetName() + "_"); + OUString aOldPageLayoutName = pBMMPage->GetLayoutName(); + pBookmarkDoc->RenameLayoutTemplate(aOldPageLayoutName, pBMMPage->GetName() + "_"); aLayout = pBMMPage->GetName(); - break; } else diff --git a/sd/source/ui/unoidl/unopage.cxx b/sd/source/ui/unoidl/unopage.cxx index 8183d6cfbfe6..a5899460e754 100644 --- a/sd/source/ui/unoidl/unopage.cxx +++ b/sd/source/ui/unoidl/unopage.cxx @@ -2984,7 +2984,12 @@ void SAL_CALL SdMasterPage::setName( const OUString& rName ) GetPage()->SetName( rName ); if( pDoc ) - pDoc->RenameLayoutTemplate( GetPage()->GetLayoutName(), rName ); + { + // tdf#164463 we need to pass a copy of the LayoutName here, a + // reference means it can get updated to rName during the function. + OUString aOldPageLayoutName = GetPage()->GetLayoutName(); + pDoc->RenameLayoutTemplate(aOldPageLayoutName, rName); + } // fake a mode change to repaint the page tab bar ::sd::DrawDocShell* pDocSh = GetModel()->GetDocShell(); diff --git a/sd/source/ui/view/drviewsb.cxx b/sd/source/ui/view/drviewsb.cxx index b585185c09d0..0f6d46460153 100644 --- a/sd/source/ui/view/drviewsb.cxx +++ b/sd/source/ui/view/drviewsb.cxx @@ -83,7 +83,8 @@ bool DrawViewShell::RenameSlide( sal_uInt16 nPageId, const OUString & rName ) { // rename MasterPage -> rename LayoutTemplate pPageToRename = GetDoc()->GetMasterSdPage( maTabControl->GetPagePos(nPageId), ePageKind ); - GetDoc()->RenameLayoutTemplate( pPageToRename->GetLayoutName(), rName ); + OUString aOldPageLayoutName = pPageToRename->GetLayoutName(); + GetDoc()->RenameLayoutTemplate(aOldPageLayoutName, rName); } bool bSuccess = (rName == pPageToRename->GetName()); |