replace a warning with an assert.
the warning was a temporary because there was a bug in the code that would have caused this assertion to fail. Since that bugs was fixed, i replaced it with an assert.
This commit is contained in:
parent
9de5d02097
commit
cad1db07d5
1 changed files with 9 additions and 8 deletions
17
src/unit.cpp
17
src/unit.cpp
|
@ -79,19 +79,20 @@ 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;
|
||||
}
|
||||
assert(u->ref_count_ >= 0);
|
||||
// the next code line is to notice possible wrongly intilized units.
|
||||
// The 100000 is picked rather randomly. If you are in the situation
|
||||
// that you can actualy have more then 100000 intrusive_ptr to one unit
|
||||
// or if you are sure that the refcounting system works
|
||||
// then feel free to remove the next line
|
||||
assert(u->ref_count_ < 100000);
|
||||
++(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;
|
||||
}
|
||||
assert(u->ref_count_ >= 1);
|
||||
assert(u->ref_count_ < 100000); //See comment in intrusive_ptr_add_ref
|
||||
if (--(u->ref_count_) == 0)
|
||||
delete u;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue