mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-07 15:04:49 +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)
|
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_);
|
++(u->ref_count_);
|
||||||
}
|
}
|
||||||
|
|
||||||
void intrusive_ptr_release(const unit * u)
|
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)
|
if (--(u->ref_count_) == 0)
|
||||||
delete u;
|
delete u;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user