Skip to content

Commit

Permalink
Fix leak of attack types
Browse files Browse the repository at this point in the history
When I first implemented this I did not fully understand the contract of boost::intrusive_ptr.
  • Loading branch information
CelticMinstrel committed Oct 19, 2016
1 parent f2406ac commit 166809e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/units/attack_type.hpp
Expand Up @@ -133,7 +133,9 @@ class attack_type
}

friend void intrusive_ptr_release(const attack_type* atk) {
--atk->ref_count;
if(--atk->ref_count == 0) {
delete atk;
}
}
};

Expand Down

0 comments on commit 166809e

Please sign in to comment.