diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-08-28 16:30:50 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-08-29 00:18:56 +0300 |
commit | 57726c7324f165c70671fc5b05d6c0964f56b870 (patch) | |
tree | 8a9f37914c18f9c6ec6d64da08834af245afe0f3 /src/resources/resource.cpp | |
parent | ee1a05faf157c8c9f0f43cf5b906d84f39ded497 (diff) | |
download | mv-57726c7324f165c70671fc5b05d6c0964f56b870.tar.gz mv-57726c7324f165c70671fc5b05d6c0964f56b870.tar.bz2 mv-57726c7324f165c70671fc5b05d6c0964f56b870.tar.xz mv-57726c7324f165c70671fc5b05d6c0964f56b870.zip |
improve debug checkers.
add missing surface functions for debugging.
Diffstat (limited to 'src/resources/resource.cpp')
-rw-r--r-- | src/resources/resource.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
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<void*>(this)); mRefCount++; + logger->log("after incRef: %p, %d", static_cast<void*>(this), mRefCount); +#else + mRefCount++; +#endif } void Resource::decRef() { +#ifdef DEBUG_IMAGES + logger->log("before decRef for: %p", static_cast<void*>(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<void*>(this), mRefCount); +#endif + if (mRefCount == 0 && !mNotCount) { // Warn the manager that this resource is no longer used. |