From cc8fd5280a14730288eea48cd3044d1229efe345 Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Tue, 23 Aug 2011 15:55:53 +0200 Subject: [PATCH] More small fixes Use [] + & instead of at() + replace Fix memory leak --- core/textpage.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/core/textpage.cpp b/core/textpage.cpp index c86a4cb74..2318f2cab 100644 --- a/core/textpage.cpp +++ b/core/textpage.cpp @@ -1817,8 +1817,8 @@ void TextPagePrivate::addNecessarySpace() // Only change the texts under RegionTexts, not the area for(j = 0 ; j < tree.length() ; j++) { - RegionText tmp = tree.at(j); - TextList tmpList = tmp.text(); + RegionText &tmpRegion = tree[j]; + TextList tmpList = tmpRegion.text(); SortedTextList lines; LineRect line_rects; @@ -1858,8 +1858,8 @@ void TextPagePrivate::addNecessarySpace() } } - while(tmpList.length()) - tmpList.pop_back(); + qDeleteAll(tmpList); + tmpList.clear(); for( i = 0 ; i < lines.length() ; i++) { @@ -1871,8 +1871,7 @@ void TextPagePrivate::addNecessarySpace() } } - tmp.setText(tmpList); - tree.replace(j,tmp); + tmpRegion.setText(tmpList); } // Step 03