From 57726c7324f165c70671fc5b05d6c0964f56b870 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 28 Aug 2013 16:30:50 +0300 Subject: improve debug checkers. add missing surface functions for debugging. --- src/resources/resource.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/resources/resource.cpp') diff --git a/src/resources/resource.cpp b/src/resources/resource.cpp index b67fe644b..b12e2f511 100644 --- a/src/resources/resource.cpp +++ b/src/resources/resource.cpp @@ -35,11 +35,21 @@ Resource::~Resource() void Resource::incRef() { +#ifdef DEBUG_IMAGES + logger->log("before incRef for: %p", static_cast(this)); mRefCount++; + logger->log("after incRef: %p, %d", static_cast(this), mRefCount); +#else + mRefCount++; +#endif } void Resource::decRef() { +#ifdef DEBUG_IMAGES + logger->log("before decRef for: %p", static_cast(this)); +#endif + // Reference may not already have reached zero if (mRefCount == 0) { @@ -49,6 +59,10 @@ void Resource::decRef() mRefCount--; +#ifdef DEBUG_IMAGES + logger->log("after decRef: %p, %d", static_cast(this), mRefCount); +#endif + if (mRefCount == 0 && !mNotCount) { // Warn the manager that this resource is no longer used. -- cgit v1.2.3-70-g09d2