Fix memory issues.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2021-03-07 18:20:42 +01:00
parent 7216d9d71b
commit 20f90222d1
3 changed files with 12 additions and 8 deletions

View File

@@ -11,6 +11,12 @@ public:
AngelScriptItemUseScript(asIScriptObject* scriptObject, const AngelScriptResolver* resolver)
: _scriptObject(scriptObject), _resolver(resolver) {}
~AngelScriptItemUseScript(){
if (_scriptObject != nullptr){
_scriptObject->Release();
}
}
[[nodiscard]] bool IsItemUsable() const override;
[[nodiscard]] bool IsCreatureUseItem() const override;
bool IsUseValidForCreature(CreatureLib::Battling::Creature* creature) const override;

View File

@@ -34,6 +34,9 @@ private:
public:
~AngelScriptResolver() override {
for (const auto& ius : _itemUseScripts) {
delete ius.second;
}
delete _contextPool;
for (const auto& category : _typeDatabase) {
for (const auto& type : category.second) {