mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-06 22:36:34 +00:00
added test checks in intrusive_ptr_add_ref/release
This commit is contained in:
parent
ebaea5812d
commit
11bd01b91a
@ -79,11 +79,19 @@ namespace {
|
||||
|
||||
void intrusive_ptr_add_ref(const unit * u)
|
||||
{
|
||||
if(u->ref_count_ > 1000 || u->ref_count_ < 0)
|
||||
{
|
||||
WRN_UT << "found very much references: " << u->ref_count_ << " of them " << std::endl;
|
||||
}
|
||||
++(u->ref_count_);
|
||||
}
|
||||
|
||||
void intrusive_ptr_release(const unit * u)
|
||||
{
|
||||
if(u->ref_count_ > 1000 || u->ref_count_ < 0)
|
||||
{
|
||||
WRN_UT << "found very much references: " << u->ref_count_ << " of them " << std::endl;
|
||||
}
|
||||
if (--(u->ref_count_) == 0)
|
||||
delete u;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user