diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-12-24 21:07:24 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-12-24 21:07:24 +0300 |
commit | daa6841b2d2d2d4de530ffe01123fa62c1336e73 (patch) | |
tree | e5172392252851c54b11ae50d7480aca5e270cb7 /src/being/being.cpp | |
parent | 34c821abdad0af3064d7e3ee9585bbbb35953a15 (diff) | |
download | manaplus-daa6841b2d2d2d4de530ffe01123fa62c1336e73.tar.gz manaplus-daa6841b2d2d2d4de530ffe01123fa62c1336e73.tar.bz2 manaplus-daa6841b2d2d2d4de530ffe01123fa62c1336e73.tar.xz manaplus-daa6841b2d2d2d4de530ffe01123fa62c1336e73.zip |
fix possible pets leak.
Diffstat (limited to 'src/being/being.cpp')
-rw-r--r-- | src/being/being.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/being/being.cpp b/src/being/being.cpp index 90c5cb316..383c3a14a 100644 --- a/src/being/being.cpp +++ b/src/being/being.cpp @@ -243,7 +243,12 @@ Being::~Being() if (mOwner) mOwner->setPet(nullptr); if (mPet) + { mPet->setOwner(nullptr); + actorManager->erase(mPet); + delete mPet; + mPet = nullptr; + } removeAllItemsParticles(); } @@ -2921,7 +2926,6 @@ std::string Being::loadComment(const std::string &name, const int type) } str.append(stringToHexPath(name)).append("/comment.txt"); - logger->log("load from: %s", str.c_str()); const ResourceManager *const resman = ResourceManager::getInstance(); if (resman->existsLocal(str)) @@ -3143,7 +3147,8 @@ void Being::removePet() if (mPet) { mPet->setOwner(nullptr); - actorManager->destroy(mPet); + actorManager->erase(mPet); + delete mPet; mPet = nullptr; } } |