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

New commits:
commit 495563ecfdac26111f36b27acbe6caaac0d402fb
Author:     Noel Grandin <noelgran...@gmail.com>
AuthorDate: Sun Aug 7 22:37:13 2022 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Wed Aug 10 08:07:26 2022 +0200

    unique_ptr->optional in MoveNodeRange
    
    Change-Id: Ibc75ffd2ec5bad7eb3ef99fae526dd49b2f4e8c8
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138001
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx 
b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index bf117aa93603..86f49874452e 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -2618,17 +2618,17 @@ bool DocumentContentOperationsManager::MoveNodeRange( 
SwNodeRange& rRange, SwNod
     // Set it to before the Position, so that it cannot be moved further.
     SwNodeIndex aIdx( rPos, -1 );
 
-    std::unique_ptr<SwNodeIndex> pSaveInsPos;
+    std::optional<SwNodeIndex> oSaveInsPos;
     if( pUndo )
-        pSaveInsPos.reset(new SwNodeIndex( rRange.aStart, -1 ));
+        oSaveInsPos.emplace(rRange.aStart, -1 );
 
     // move the Nodes
     bool bNoDelFrames = bool(SwMoveFlags::NO_DELFRMS & eMvFlags);
     if( m_rDoc.GetNodes().MoveNodes( rRange, m_rDoc.GetNodes(), rPos, 
!bNoDelFrames ) )
     {
         ++aIdx;     // again back to old position
-        if( pSaveInsPos )
-            ++(*pSaveInsPos);
+        if( oSaveInsPos )
+            ++(*oSaveInsPos);
     }
     else
     {
@@ -2666,11 +2666,11 @@ bool DocumentContentOperationsManager::MoveNodeRange( 
SwNodeRange& rRange, SwNod
 
     if( pUndo )
     {
-        pUndo->SetDestRange( aIdx, rPos, *pSaveInsPos );
+        pUndo->SetDestRange( aIdx, rPos, *oSaveInsPos );
         m_rDoc.GetIDocumentUndoRedo().AppendUndo(std::move(pUndo));
     }
 
-    pSaveInsPos.reset();
+    oSaveInsPos.reset();
 
     if( bUpdateFootnote )
     {

Reply via email to