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

Kohei Yoshida kohei.yoshida at collabora.com
Fri May 5 02:25:00 UTC 2017


 sc/source/ui/app/inputhdl.cxx |   13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

New commits:
commit 4633d3d539d32236527a7056c50a04e373f8038d
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Thu May 4 18:23:28 2017 -0400

    Use std::unique_ptr for these guys.
    
    Change-Id: I36510129f95548db3b156025a1bfe631577ec610
    Reviewed-on: https://gerrit.libreoffice.org/37267
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Kohei Yoshida <libreoffice at kohei.us>

diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index e914894145e3..dea393379fb8 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -2603,8 +2603,8 @@ void ScInputHandler::EnterHandler( ScEnterMode nBlockMode )
     bool bMatrix = ( nBlockMode == ScEnterMode::MATRIX );
 
     SfxApplication* pSfxApp     = SfxGetpApp();
-    EditTextObject* pObject     = nullptr;
-    ScPatternAttr*  pCellAttrs  = nullptr;
+    std::unique_ptr<EditTextObject> pObject;
+    std::unique_ptr<ScPatternAttr> pCellAttrs;
     bool            bForget     = false; // Remove due to validity?
 
     OUString aString = GetEditText(mpEditEngine.get());
@@ -2742,7 +2742,7 @@ void ScInputHandler::EnterHandler( ScEnterMode nBlockMode )
             if ( pCommonAttrs )
             {
                 ScDocument* pDoc = pActiveViewSh->GetViewData().GetDocument();
-                pCellAttrs = new ScPatternAttr( pDoc->GetPool() );
+                pCellAttrs = o3tl::make_unique<ScPatternAttr>(pDoc->GetPool());
                 pCellAttrs->GetFromEditItemSet( pCommonAttrs );
                 delete pCommonAttrs;
             }
@@ -2798,7 +2798,7 @@ void ScInputHandler::EnterHandler( ScEnterMode nBlockMode )
         if (bAttrib)
         {
             mpEditEngine->ClearSpellErrors();
-            pObject = mpEditEngine->CreateTextObject();
+            pObject.reset(mpEditEngine->CreateTextObject());
         }
         else if (bAutoComplete) // Adjust Upper/Lower case
         {
@@ -2893,7 +2893,7 @@ void ScInputHandler::EnterHandler( ScEnterMode nBlockMode )
 
             ScInputStatusItem aItem( FID_INPUTLINE_STATUS,
                                      aCursorPos, aCursorPos, aCursorPos,
-                                     aString, pObject );
+                                     aString, pObject.get() );
 
             if (!aMisspellRanges.empty())
                 aItem.SetMisspellRanges(&aMisspellRanges);
@@ -2917,9 +2917,6 @@ void ScInputHandler::EnterHandler( ScEnterMode nBlockMode )
         pExecuteSh->AdjustBlockHeight();
     }
 
-    delete pCellAttrs;
-    delete pObject;
-
     HideTip();
     HideTipBelow();
 


More information about the Libreoffice-commits mailing list