Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use UnitPtr (intrusive_ptr) in unit_animations
In this commit the unit * in unit_animation is changed to a smart pointer. This is to prevent the unit_map or some other object from destroying the unit and creating a dangling pointer (reported to cause segfaults). In this commit, we also change the fake_unit class to make sure to increment the refcounter when the fake_unit is constructed. The reason is that the fake_unit holder is supposed to own that unit and let it expire when it goes out of scope. No smart pointer is supposed to delete it. This mechanism should possibly be revisited, for example the fake units could also be held in a reference counted pointer. With the current system it is still possible that the fake_unit will go out of scope and be destoryed while the animation is still alive, this change only prevents smart pointers from destroying it before it goes out of scope. I also comment out the reentry_preventer class uses in unit_animation.cpp, to prevent assertions from happening when I test for example with the "double debug kill" version of the bug. The reentry_preventer seems to be unnecessary now. This addresses bug #18921 and maybe others.
- Loading branch information
Showing
4 changed files
with
14 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters