[Libreoffice-commits] core.git: starmath/inc starmath/source

Takeshi Abe tabe at fixedpoint.jp
Thu Dec 10 02:40:40 PST 2015


 starmath/inc/ElementsDockingWindow.hxx    |    5 +----
 starmath/source/ElementsDockingWindow.cxx |    7 +++----
 2 files changed, 4 insertions(+), 8 deletions(-)

New commits:
commit 434d8e2c7042a4d11b9d74ce84434e2bcc249038
Author: Takeshi Abe <tabe at fixedpoint.jp>
Date:   Wed Dec 9 17:59:04 2015 +0900

    starmath: SmElementPointer is not shared actually
    
    ... rather, it's owned by maElementList.
    So, use just std::unique_ptr<SmElement> instead.
    
    Change-Id: Id18466083535677e0f7d07f8c523b433c5e2a9ec
    Reviewed-on: https://gerrit.libreoffice.org/20490
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noelgrandin at gmail.com>

diff --git a/starmath/inc/ElementsDockingWindow.hxx b/starmath/inc/ElementsDockingWindow.hxx
index e57e50c..4e1652a 100644
--- a/starmath/inc/ElementsDockingWindow.hxx
+++ b/starmath/inc/ElementsDockingWindow.hxx
@@ -85,15 +85,12 @@ class SmElementsControl : public Control
     virtual void MouseButtonDown(const MouseEvent& rMEvt) override;
     virtual void MouseMove( const MouseEvent& rMEvt ) override;
 
-    typedef std::shared_ptr<SmElement>    SmElementPointer;
-    typedef std::vector< SmElementPointer > SmElementList;
-
     SmDocShell*   mpDocShell;
     SmFormat      maFormat;
     sal_uInt16    maCurrentSetId;
     SmElement*    mpCurrentElement;
 
-    SmElementList maElementList;
+    std::vector< std::unique_ptr<SmElement> > maElementList;
     Size          maMaxElementDimensions;
     bool          mbVerticalMode;
     VclPtr< ScrollBar > mxScroll;
diff --git a/starmath/source/ElementsDockingWindow.cxx b/starmath/source/ElementsDockingWindow.cxx
index 229eeedb..b3b0f2c 100644
--- a/starmath/source/ElementsDockingWindow.cxx
+++ b/starmath/source/ElementsDockingWindow.cxx
@@ -24,6 +24,7 @@
 #include <view.hxx>
 #include <visitors.hxx>
 
+#include <o3tl/make_unique.hxx>
 #include <svl/stritem.hxx>
 #include <sfx2/dispatch.hxx>
 #include <sfx2/sfxmodelfactory.hxx>
@@ -457,8 +458,7 @@ void SmElementsControl::DoScroll(long nDelta)
 
 void SmElementsControl::addSeparator()
 {
-    SmElementPointer pElement(new SmElementSeparator());
-    maElementList.push_back(pElement);
+    maElementList.push_back(o3tl::make_unique<SmElementSeparator>());
 }
 
 void SmElementsControl::addElement(const OUString& aElementVisual, const OUString& aElementSource, const OUString& aHelpText)
@@ -478,8 +478,7 @@ void SmElementsControl::addElement(const OUString& aElementVisual, const OUStrin
         maMaxElementDimensions.Height() = aSizePixel.Height();
     }
 
-    SmElementPointer pElement(new SmElement(pNode, aElementSource, aHelpText));
-    maElementList.push_back(pElement);
+    maElementList.push_back(o3tl::make_unique<SmElement>(pNode, aElementSource, aHelpText));
 }
 
 void SmElementsControl::setElementSetId(sal_uInt16 aSetId)


More information about the Libreoffice-commits mailing list