sw/source/core/doc/docfmt.cxx |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit ec694a32ea6c9f0287e8c12f4de62047abfcde72
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Thu May 26 12:47:53 2022 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Thu May 26 16:00:38 2022 +0200

    avoid some allocation in SwDoc::ResetAttrs
    
    can put SwDataChanged on the stack
    
    Change-Id: I6631d04e181e2156184833642abdfab83092da60
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135015
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx
index bbdd0b1ea6fb..dbf8fefeda4a 100644
--- a/sw/source/core/doc/docfmt.cxx
+++ b/sw/source/core/doc/docfmt.cxx
@@ -296,10 +296,10 @@ void SwDoc::ResetAttrs( const SwPaM &rRg,
     }
 
     // #i96644#
-    std::unique_ptr< SwDataChanged > xDataChanged;
+    std::optional< SwDataChanged > oDataChanged;
     if ( bSendDataChangedEvents )
     {
-        xDataChanged.reset( new SwDataChanged( *pPam ) );
+        oDataChanged.emplace( *pPam );
     }
     SwHistory* pHst = nullptr;
     if (GetIDocumentUndoRedo().DoesUndo())
@@ -395,7 +395,7 @@ void SwDoc::ResetAttrs( const SwPaM &rRg,
 
     getIDocumentState().SetModified();
 
-    xDataChanged.reset(); //before delete pPam
+    oDataChanged.reset(); //before delete pPam
 
     if( pPam != &rRg )
         delete pPam;

Reply via email to