include/svx/svdpage.hxx         |    2 --
 sd/inc/sdpage.hxx               |    2 +-
 sd/source/core/stlfamily.cxx    |   11 +++++------
 sd/source/ui/unoidl/unopage.cxx |    7 ++++++-
 sd/source/ui/view/drviewsb.cxx  |    3 ++-
 sd/source/ui/view/outlnvsh.cxx  |    2 +-
 svx/source/svdraw/svdpage.cxx   |    5 -----
 7 files changed, 15 insertions(+), 17 deletions(-)

New commits:
commit 24c88dd4de6ab88fdd73475baac3aed6e436d99e
Author:     Xisco Fauli <[email protected]>
AuthorDate: Thu Mar 6 11:21:57 2025 +0100
Commit:     Aron Budea <[email protected]>
CommitDate: Thu Feb 5 06:46:35 2026 +0100

    Revert "tdf#165504 restore SdrPage::GetLayoutName virtual"
    
    This reverts commit 5137fcc47f8e40dcba991db1f57dc1b395bbf970.
    
    The commit I bisected in
    https://bugs.documentfoundation.org/show_bug.cgi?id=165504#c3
    was actually the same as tdf#164463 which got fixed in
    960db01dbfe2f916b91782da03532fae1f836445 "Resolves: tdf#164463 we need
    to pass a copy of the LayoutName"
    So this revert is not necessary.
    I'm really sorry for all the inconveniences caused.
    
    Conflicts:
          sd/source/core/drawdoc3.cxx
    
    Change-Id: Ice96b06220decf8078658b61ca721638cc8d2254
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182578
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <[email protected]>
    (cherry picked from commit efaceac76b91cb114c9f87d56872f085143cabab)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198443
    Reviewed-by: Michael Stahl <[email protected]>
    Tested-by: Jenkins CollaboraOffice <[email protected]>

diff --git a/include/svx/svdpage.hxx b/include/svx/svdpage.hxx
index 4b0a4eb84b51..838011b9d32d 100644
--- a/include/svx/svdpage.hxx
+++ b/include/svx/svdpage.hxx
@@ -530,8 +530,6 @@ public:
     const SdrLayerAdmin& GetLayerAdmin() const;
     SdrLayerAdmin& GetLayerAdmin();
 
-    virtual OUString GetLayoutName() const;
-
     /// for snap-to-grid in Writer, also for AlignObjects if 1 object is marked
     /// if pRect != null, then the pages that are intersected by this Rect,
     /// otherwise the visible pages
diff --git a/sd/inc/sdpage.hxx b/sd/inc/sdpage.hxx
index 4415fd28506c..e3d6353149be 100644
--- a/sd/inc/sdpage.hxx
+++ b/sd/inc/sdpage.hxx
@@ -256,7 +256,7 @@ public:
                          const ::tools::Rectangle& rOldBoundRect) override;
 
     void             SetLayoutName(const OUString& aName);
-    virtual OUString GetLayoutName() const override       { return 
maLayoutName; }
+    const OUString& GetLayoutName() const { return maLayoutName; }
 
     void            SetFileName(const OUString& aName) { maFileName = aName; }
     const OUString& GetFileName() const       { return maFileName; }
diff --git a/sd/source/core/stlfamily.cxx b/sd/source/core/stlfamily.cxx
index 75c2fe2a84ef..289405f0828a 100644
--- a/sd/source/core/stlfamily.cxx
+++ b/sd/source/core/stlfamily.cxx
@@ -192,12 +192,11 @@ OUString SAL_CALL SdStyleFamily::getName()
         if( pPage == nullptr )
             throw DisposedException();
 
-        OUString aLayoutName( pPage->GetLayoutName() );
-        sal_Int32 nIndex = aLayoutName.indexOf(SD_LT_SEPARATOR);
-        if( nIndex != -1 )
-            aLayoutName = aLayoutName.copy(0, nIndex);
-
-        return aLayoutName;
+        const OUString& rLayoutName = pPage->GetLayoutName();
+        sal_Int32 nIndex = rLayoutName.indexOf(SD_LT_SEPARATOR);
+        if (nIndex != -1)
+            return rLayoutName.copy(0, nIndex);
+        return rLayoutName;
     }
     else
     {
diff --git a/sd/source/ui/unoidl/unopage.cxx b/sd/source/ui/unoidl/unopage.cxx
index a15db4b6eb6a..bee2b0847066 100644
--- a/sd/source/ui/unoidl/unopage.cxx
+++ b/sd/source/ui/unoidl/unopage.cxx
@@ -2996,7 +2996,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());
diff --git a/sd/source/ui/view/outlnvsh.cxx b/sd/source/ui/view/outlnvsh.cxx
index 21b60301c2d0..e224c8b56828 100644
--- a/sd/source/ui/view/outlnvsh.cxx
+++ b/sd/source/ui/view/outlnvsh.cxx
@@ -1320,7 +1320,7 @@ void OutlineViewShell::GetStatusBarState(SfxItemSet& rSet)
         if( nPos >= GetDoc()->GetSdPageCount( PageKind::Standard ) )
             nPos = 0;
 
-        SdrPage* pPage = GetDoc()->GetSdPage( static_cast<sal_uInt16>(nPos), 
PageKind::Standard );
+        SdPage* pPage = GetDoc()->GetSdPage( static_cast<sal_uInt16>(nPos), 
PageKind::Standard );
 
         if (GetDoc()->GetDocumentType() == DocumentType::Draw)
             aPageStr = SdResId(STR_SD_PAGE_COUNT_DRAW);
diff --git a/svx/source/svdraw/svdpage.cxx b/svx/source/svdraw/svdpage.cxx
index 8d1329cf923f..7bf1f272e1f6 100644
--- a/svx/source/svdraw/svdpage.cxx
+++ b/svx/source/svdraw/svdpage.cxx
@@ -1749,11 +1749,6 @@ SdrLayerAdmin& SdrPage::GetLayerAdmin()
     return *mpLayerAdmin;
 }
 
-OUString SdrPage::GetLayoutName() const
-{
-    return OUString();
-}
-
 void SdrPage::SetInserted( bool bIns )
 {
     if( mbInserted == bIns )

Reply via email to