Skip to content

Commit

Permalink
Fixed|Widgets|Debug: Counting total number of ref counted objects
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Nov 22, 2016
1 parent f520ef0 commit 5d2ce9c
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions doomsday/sdk/libcore/src/widgets/constantrule.cpp
Expand Up @@ -22,8 +22,6 @@

namespace de {

static AutoRef<ConstantRule> zeroRule(new ConstantRule(0));

ConstantRule::ConstantRule() : Rule(), _pendingValue(0)
{
// No valid value defined.
Expand Down Expand Up @@ -51,7 +49,15 @@ String ConstantRule::description() const

ConstantRule const &ConstantRule::zero()
{
return zeroRule;
static ConstantRule *zeroRule = nullptr;
if (!zeroRule)
{
zeroRule = new ConstantRule(0); // won't be deleted ever
#ifdef DENG2_DEBUG
Counted::totalCount--;
#endif
}
return *zeroRule;
}

void ConstantRule::update()
Expand Down

0 comments on commit 5d2ce9c

Please sign in to comment.