summaryrefslogtreecommitdiff
path: root/starmath/source
diff options
context:
space:
mode:
Diffstat (limited to 'starmath/source')
-rw-r--r--starmath/source/caret.cxx3
-rw-r--r--starmath/source/cursor.cxx3
-rw-r--r--starmath/source/visitors.cxx5
3 files changed, 7 insertions, 4 deletions
diff --git a/starmath/source/caret.cxx b/starmath/source/caret.cxx
index 524ae9efa240..9f9e8f6abc51 100644
--- a/starmath/source/caret.cxx
+++ b/starmath/source/caret.cxx
@@ -39,8 +39,7 @@ SmCaretPosGraphEntry* SmCaretPosGraph::Add(SmCaretPosGraphEntry entry){
}
SmCaretPosGraph::~SmCaretPosGraph(){
- if(pNext)
- delete pNext;
+ delete pNext;
pNext = NULL;
}
diff --git a/starmath/source/cursor.cxx b/starmath/source/cursor.cxx
index 81b1f597324d..e00ca8109d27 100644
--- a/starmath/source/cursor.cxx
+++ b/starmath/source/cursor.cxx
@@ -120,10 +120,9 @@ void SmCursor::BuildGraph(){
anchor = NULL;
position = NULL;
}
- pGraph = NULL;
//Build the new graph
- pGraph = SmCaretPosGraphBuildingVisitor(pTree).Graph();
+ pGraph = SmCaretPosGraphBuildingVisitor(pTree).takeGraph();
//Restore anchor and position pointers
if(_anchor.IsValid() || _position.IsValid()){
diff --git a/starmath/source/visitors.cxx b/starmath/source/visitors.cxx
index 941739c6fffa..93ea409dde1f 100644
--- a/starmath/source/visitors.cxx
+++ b/starmath/source/visitors.cxx
@@ -990,6 +990,11 @@ SmCaretPosGraphBuildingVisitor::SmCaretPosGraphBuildingVisitor( SmNode* pRootNod
pRootNode->Accept(this);
}
+SmCaretPosGraphBuildingVisitor::~SmCaretPosGraphBuildingVisitor()
+{
+ delete pGraph;
+}
+
void SmCaretPosGraphBuildingVisitor::Visit( SmLineNode* pNode ){
SmNodeIterator it( pNode );
while( it.Next( ) ){