[Libreoffice-commits] core.git: starmath/inc starmath/source
Takeshi Abe
tabe at fixedpoint.jp
Wed Oct 7 23:21:35 PDT 2015
starmath/inc/cursor.hxx | 6 ++----
starmath/source/cursor.cxx | 4 ++--
2 files changed, 4 insertions(+), 6 deletions(-)
New commits:
commit ce924d97aaea265b8f58265bedb49dbcd71fbc31
Author: Takeshi Abe <tabe at fixedpoint.jp>
Date: Wed Oct 7 23:21:00 2015 +0900
starmath: Represent ownership by std::unique_ptr
Change-Id: I7ce39cbdc0199d3508e7d16d1ce0b78f8d8ca620
Reviewed-on: https://gerrit.libreoffice.org/19230
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin at gmail.com>
diff --git a/starmath/inc/cursor.hxx b/starmath/inc/cursor.hxx
index 964c65c..2988828 100644
--- a/starmath/inc/cursor.hxx
+++ b/starmath/inc/cursor.hxx
@@ -13,6 +13,7 @@
#include "caret.hxx"
#include <list>
+#include <memory>
/** Factor to multiple the squared horizontal distance with
* Used for Up and Down movement.
@@ -82,7 +83,6 @@ public:
, mpPosition(nullptr)
, mpTree(tree)
, mpDocShell(pShell)
- , mpGraph(nullptr)
, mpClipboard(nullptr)
, mnEditSections(0)
, mbIsEnabledSetModifiedSmDocShell(false)
@@ -94,8 +94,6 @@ public:
~SmCursor()
{
SetClipboard();
- delete mpGraph;
- mpGraph = nullptr;
}
/** Get position */
@@ -230,7 +228,7 @@ private:
/** Owner of the formula tree */
SmDocShell* mpDocShell;
/** Graph over caret position in the current tree */
- SmCaretPosGraph* mpGraph;
+ std::unique_ptr<SmCaretPosGraph> mpGraph;
/** Clipboard holder */
SmNodeList* mpClipboard;
diff --git a/starmath/source/cursor.cxx b/starmath/source/cursor.cxx
index 01c4b37..954563e 100644
--- a/starmath/source/cursor.cxx
+++ b/starmath/source/cursor.cxx
@@ -114,14 +114,14 @@ void SmCursor::BuildGraph(){
_anchor = mpAnchor->CaretPos;
if(mpPosition)
_position = mpPosition->CaretPos;
- delete mpGraph;
+ mpGraph.reset();
//Reset anchor and position as they point into an old graph
mpAnchor = nullptr;
mpPosition = nullptr;
}
//Build the new graph
- mpGraph = SmCaretPosGraphBuildingVisitor(mpTree).takeGraph();
+ mpGraph.reset(SmCaretPosGraphBuildingVisitor(mpTree).takeGraph());
//Restore anchor and position pointers
if(_anchor.IsValid() || _position.IsValid()){
More information about the Libreoffice-commits
mailing list