[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: kdeedu/klettres/klettres
From: Anne-Marie Mahfouf <annma () kde ! org>
Date: 2005-04-29 23:39:21
Message-ID: 20050429233921.9D947668 () office ! kde ! org
[Download RAW message or body]
CVS commit by annma:
fix memory leak by using QStringList
yeah, I am now using valgrind, thanks Albert aka TSDGeos for some hints!
M +6 -9 soundfactory.cpp 1.19
M +2 -2 soundfactory.h 1.11
--- kdeedu/klettres/klettres/soundfactory.cpp #1.18:1.19
@@ -49,6 +49,4 @@ SoundFactory::SoundFactory(KLettres *par
SoundFactory::~SoundFactory()
{
- if (namesList) delete [] namesList;
- if (filesList) delete [] filesList;
}
@@ -132,8 +130,6 @@ bool SoundFactory::loadLanguage(QDomDocu
return false;
- if (!(namesList = new QString[sounds]))
- return false;
- if (!(filesList = new QString[sounds]))
- return false;
+ namesList.clear();
+ filesList.clear();
for (uint sound = 0; sound < sounds; sound++)
@@ -142,10 +138,11 @@ bool SoundFactory::loadLanguage(QDomDocu
nameAttribute = soundNameElement.attributeNode("name");
//namesList helds the names of the letter or syllable to display
- namesList[sound] = nameAttribute.value();
+ namesList.append(nameAttribute.value());
fileAttribute = soundNameElement.attributeNode("file");
//filesList helds the names of the sound files (i.e the location of the \
sounds like fr/alpha/a-0.mp3)
- filesList[sound] = fileAttribute.value();
- kdDebug() << "fileLists[sound] " << filesList[sound] << endl;
+ filesList.append(fileAttribute.value());
}
+ if (namesList.isEmpty()) return false;
+ if (filesList.isEmpty()) return false;
return true;
}
--- kdeedu/klettres/klettres/soundfactory.h #1.10:1.11
@@ -57,7 +57,7 @@ public:
uint sounds;
///List of sound names
- QString *namesList;
+ QStringList namesList;
///List of sound files associated with each sound name
- QString *filesList;
+ QStringList filesList;
/**
* Load the sounds of one given language
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic