r18643 by jghali - fix memory leak detected by Visual Leak Detector

scribus-commit scribus-commit at lists.scribus.net
Sat Dec 14 12:58:55 UTC 2013


Author: jghali
Date: Sat Dec 14 12:58:54 2013
New Revision: 18643

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=18643
Log:
fix memory leak detected by Visual Leak Detector

Modified:
    trunk/Scribus/scribus/prefstable.cpp
    trunk/Scribus/scribus/prefstable.h

Modified: trunk/Scribus/scribus/prefstable.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18643&path=/trunk/Scribus/scribus/prefstable.cpp
==============================================================================
--- trunk/Scribus/scribus/prefstable.cpp (original)
+++ trunk/Scribus/scribus/prefstable.cpp Sat Dec 14 12:58:54 2013
@@ -61,10 +61,10 @@
 QString PrefsTable::get(int row, int col, const QString& defValue)
 {
 	checkSize(row, col, defValue);
-	if ((*table[row])[col] == "__NOT__SET__")
-		table[row]->insert(table[row]->begin()+col, defValue);
-
-	return (*table[row])[col];
+	if (table[row][col] == "__NOT__SET__")
+		table[row].insert(table[row].begin()+col, defValue);
+
+	return (table[row][col]);
 }
 
 void PrefsTable::set(int row, int col, const char* value)
@@ -80,7 +80,7 @@
 void PrefsTable::set(int row, int col, const QString& value)
 {
 	checkSize(row, col, "__NOT__SET__");
-	table[row]->insert(table[row]->begin()+col, value);
+	table[row].insert(table[row].begin()+col, value);
 }
 
 int PrefsTable::getInt(int row, int col, int defValue)
@@ -192,21 +192,21 @@
 	if (rowCount < (rowIndex + 1))
 	{
 		for (int i = 0; i < ((rowIndex + 1) - rowCount); ++i)
-			table.push_back(new QStringList());
+			table.push_back(QStringList());
 		rowCount = rowIndex + 1;
 	}
 }
 
 void PrefsTable::checkWidth(int rowIndex, int colIndex, QString defValue)
 {
-	if (static_cast<int>(table[rowIndex]->size()) <= (colIndex + 1))
-	{
-		for (int i = 0; i < ((colIndex + 1) - static_cast<int>(table[rowIndex]->size())); ++i)
+	if (static_cast<int>(table[rowIndex].size()) <= (colIndex + 1))
+	{
+		for (int i = 0; i < ((colIndex + 1) - static_cast<int>(table[rowIndex].size())); ++i)
 		{
-			if (i == colIndex - static_cast<int>(table[rowIndex]->size()))
-				table[rowIndex]->push_back(defValue);
+			if (i == colIndex - static_cast<int>(table[rowIndex].size()))
+				table[rowIndex].push_back(defValue);
 			else
-				table[rowIndex]->push_back("__NOT__SET__");
+				table[rowIndex].push_back("__NOT__SET__");
 		}
 		colCount = colIndex + 1;
 	}

Modified: trunk/Scribus/scribus/prefstable.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18643&path=/trunk/Scribus/scribus/prefstable.h
==============================================================================
--- trunk/Scribus/scribus/prefstable.h (original)
+++ trunk/Scribus/scribus/prefstable.h Sat Dec 14 12:58:54 2013
@@ -35,7 +35,7 @@
 
 #include "scribusapi.h"
 
-typedef std::vector<QStringList*> Table;
+typedef std::vector<QStringList> Table;
 
 class SCRIBUS_API PrefsTable
 {




More information about the scribus-commit mailing list