[Libreoffice-commits] core.git: 2 commits - sc/source sw/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Sat Oct 10 20:20:31 UTC 2020


 sc/source/filter/excel/xiescher.cxx       |    2 +-
 sc/source/ui/unoobj/editsrc.cxx           |    4 +---
 sw/source/filter/ww8/ww8graf.cxx          |    4 +---
 sw/source/uibase/docvw/AnnotationWin2.cxx |    2 +-
 4 files changed, 4 insertions(+), 8 deletions(-)

New commits:
commit c616a663b3c7bc107f11cb3abb3cf8845083ac60
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sat Oct 10 19:32:29 2020 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Sat Oct 10 22:19:57 2020 +0200

    we are cloning the contents of a temporary std::unique_ptr
    
    which is destroyed immediately after anyway, so just take ownership
    directly
    
    Change-Id: I70d508da54ca26024da0640c10a043d5bd02d331
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104175
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sw/source/uibase/docvw/AnnotationWin2.cxx b/sw/source/uibase/docvw/AnnotationWin2.cxx
index dbbaceb5e11d..e252f0fed78c 100644
--- a/sw/source/uibase/docvw/AnnotationWin2.cxx
+++ b/sw/source/uibase/docvw/AnnotationWin2.cxx
@@ -1272,7 +1272,7 @@ void SwAnnotationWin::ExecuteCommand(sal_uInt16 nSlot)
             // will be created
             if (!mpOutliner->GetEditEngine().GetText().isEmpty())
             {
-                OutlinerParaObject* pPara = new OutlinerParaObject(*GetOutlinerView()->GetEditView().CreateTextObject());
+                OutlinerParaObject* pPara = new OutlinerParaObject(GetOutlinerView()->GetEditView().CreateTextObject());
                 mrMgr.RegisterAnswer(pPara);
             }
             if (mrMgr.HasActiveSidebarWin())
commit 06bc9956769cef5e0f45d621453517e95845bbdb
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sat Oct 10 19:29:16 2020 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Sat Oct 10 22:19:40 2020 +0200

    we throw away the original of the clone
    
    so we can take ownership of the original instead
    
    Change-Id: I2399aa77b22e606008a5aed2bc73361e13b68455
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104174
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sc/source/filter/excel/xiescher.cxx b/sc/source/filter/excel/xiescher.cxx
index 0aff723b16b4..c0d63ee01d1e 100644
--- a/sc/source/filter/excel/xiescher.cxx
+++ b/sc/source/filter/excel/xiescher.cxx
@@ -1497,7 +1497,7 @@ void XclImpTextObj::DoPreProcessSdrObj( XclImpDffConverter& rDffConv, SdrObject&
                 // rich text
                 std::unique_ptr< EditTextObject > xEditObj(
                     XclImpStringHelper::CreateTextObject( GetRoot(), *maTextData.mxString ) );
-                std::unique_ptr<OutlinerParaObject> pOutlineObj(new OutlinerParaObject( *xEditObj ));
+                std::unique_ptr<OutlinerParaObject> pOutlineObj(new OutlinerParaObject(std::move(xEditObj)));
                 pOutlineObj->SetOutlinerMode( OutlinerMode::TextObject );
                 pTextObj->NbcSetOutlinerParaObject( std::move(pOutlineObj) );
             }
diff --git a/sc/source/ui/unoobj/editsrc.cxx b/sc/source/ui/unoobj/editsrc.cxx
index a54ff4f0e6ee..6b3fa37447e6 100644
--- a/sc/source/ui/unoobj/editsrc.cxx
+++ b/sc/source/ui/unoobj/editsrc.cxx
@@ -169,9 +169,7 @@ void ScAnnotationEditSource::UpdateData()
 
     if( SdrObject* pObj = GetCaptionObj() )
     {
-        std::unique_ptr<EditTextObject> pEditObj = pEditEngine->CreateTextObject();
-        std::unique_ptr<OutlinerParaObject> pOPO( new OutlinerParaObject( *pEditObj ) );
-        pEditObj.reset();
+        std::unique_ptr<OutlinerParaObject> pOPO( new OutlinerParaObject(pEditEngine->CreateTextObject()) );
         pOPO->SetOutlinerMode( OutlinerMode::TextObject );
         pObj->NbcSetOutlinerParaObject( std::move(pOPO) );
         pObj->ActionChanged();
diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx
index 74a7e880829e..2bb012ea6782 100644
--- a/sw/source/filter/ww8/ww8graf.cxx
+++ b/sw/source/filter/ww8/ww8graf.cxx
@@ -1185,11 +1185,9 @@ void SwWW8ImplReader::InsertTxbxText(SdrTextObj* pTextObj,
         }
 
         bool bVertical = pTextObj->IsVerticalWriting();
-        std::unique_ptr<EditTextObject> pTemporaryText = m_pDrawEditEngine->CreateTextObject();
-        std::unique_ptr<OutlinerParaObject> pOp( new OutlinerParaObject(*pTemporaryText) );
+        std::unique_ptr<OutlinerParaObject> pOp(new OutlinerParaObject(m_pDrawEditEngine->CreateTextObject()));
         pOp->SetOutlinerMode( OutlinerMode::TextObject );
         pOp->SetVertical( bVertical );
-        pTemporaryText.reset();
         pTextObj->NbcSetOutlinerParaObject( std::move(pOp) );
         pTextObj->SetVerticalWriting(bVertical);
 


More information about the Libreoffice-commits mailing list