diff options
| author | Ben Boeckel <MathStuf@gmail.com> | 2008-03-31 02:07:25 +0000 |
|---|---|---|
| committer | Ben Boeckel <MathStuf@gmail.com> | 2008-03-31 02:07:25 +0000 |
| commit | 12d5161318a4d8d781f896812f5a95fa7b46d8a8 (patch) | |
| tree | 70617a790b791b876426d85848d20901e65d6606 /pokemod/Move.cpp | |
| parent | 9a65bc6bb7c8da1dfa5b101579e52845c75848ef (diff) | |
[FIX] Memory leaks in load and copy method
git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@96 6ecfd1a5-f3ed-3746-8530-beee90d26b22
Diffstat (limited to 'pokemod/Move.cpp')
| -rw-r--r-- | pokemod/Move.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/pokemod/Move.cpp b/pokemod/Move.cpp index aaf6af7b..d91eda87 100644 --- a/pokemod/Move.cpp +++ b/pokemod/Move.cpp @@ -63,8 +63,8 @@ Move::Move(const Pokemod* pokemod, const QString& fileName, const int id) : Move::~Move() { - foreach (MoveEffect* effect, m_effects) - delete effect; + while (effectCount()) + deleteEffect(0); } bool Move::validate() const @@ -149,7 +149,8 @@ void Move::load(const QString& fileName, int id) throw(Exception) QStringList path = pokemod()->path().split('/'); path.removeLast(); QDir fdir(path.join("/")); - m_effects.clear(); + while (effectCount()) + deleteEffect(0); if (fdir.cd("effect")) { QStringList files(fdir.entryList(QStringList("*.pini"), QDir::Files, QDir::Name)); @@ -430,7 +431,8 @@ Move& Move::operator=(const Move& rhs) m_canSnatch = rhs.m_canSnatch; m_sound = rhs.m_sound; m_description = rhs.m_description; - m_effects.clear(); + while (effectCount()) + deleteEffect(0); foreach (MoveEffect* effect, rhs.m_effects) m_effects.append(new MoveEffect(pokemod(), *effect, effect->id())); return *this; |
