summaryrefslogtreecommitdiff
path: root/src/resources/resource.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-08-28 16:30:50 +0300
committerAndrei Karas <akaras@inbox.ru>2013-08-29 00:18:56 +0300
commit57726c7324f165c70671fc5b05d6c0964f56b870 (patch)
tree8a9f37914c18f9c6ec6d64da08834af245afe0f3 /src/resources/resource.cpp
parentee1a05faf157c8c9f0f43cf5b906d84f39ded497 (diff)
downloadmanaplus-57726c7324f165c70671fc5b05d6c0964f56b870.tar.gz
manaplus-57726c7324f165c70671fc5b05d6c0964f56b870.tar.bz2
manaplus-57726c7324f165c70671fc5b05d6c0964f56b870.tar.xz
manaplus-57726c7324f165c70671fc5b05d6c0964f56b870.zip
improve debug checkers.
add missing surface functions for debugging.
Diffstat (limited to 'src/resources/resource.cpp')
-rw-r--r--src/resources/resource.cpp14
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.