diff options
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. |