summaryrefslogtreecommitdiffstats
path: root/src/common/util
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2006-06-16 23:17:46 +0000
committerDavid Robillard <d@drobilla.net>2006-06-16 23:17:46 +0000
commit471c9e43493ab1d3a83ed6a8ca53bd818a2ed275 (patch)
tree544fed2bcb9b976bbf665f8cd20029f837b9f4bb /src/common/util
parent45eae6d2d3729876b898e5964829771985eaf9f7 (diff)
downloadingen-471c9e43493ab1d3a83ed6a8ca53bd818a2ed275.tar.gz
ingen-471c9e43493ab1d3a83ed6a8ca53bd818a2ed275.tar.bz2
ingen-471c9e43493ab1d3a83ed6a8ca53bd818a2ed275.zip
More thorough assertion checking in CountedPtr;
Adding plugins to subpatches working. git-svn-id: http://svn.drobilla.net/lad/grauph@46 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/common/util')
-rw-r--r--src/common/util/CountedPtr.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/common/util/CountedPtr.h b/src/common/util/CountedPtr.h
index 10c724c5..17c56cc9 100644
--- a/src/common/util/CountedPtr.h
+++ b/src/common/util/CountedPtr.h
@@ -73,6 +73,8 @@ public:
if (copy)
retain(copy._counter);
+
+ assert(_counter == copy._counter);
}
/** Copy a CountedPtr to a valid base class.
@@ -90,12 +92,15 @@ public:
#else
T* const casted_y = static_cast<T* const>(y._counter->ptr);
#endif
- if (casted_y != NULL) {
+ if (casted_y) {
assert(casted_y == y._counter->ptr);
//release(); // FIXME: leak?
retain((Counter*)y._counter);
+ assert(_counter == (Counter*)y._counter);
}
}
+
+ assert(_counter == NULL || _counter == (Counter*)y._counter);
}
/** Assign to the value of a CountedPtr of the same type. */
@@ -106,6 +111,7 @@ public:
release();
retain(copy._counter);
}
+ assert(_counter == copy._counter);
return *this;
}
@@ -118,6 +124,7 @@ public:
release();
retain(y._counter);
}
+ assert(_counter == y._counter);
return *this;
}
@@ -179,7 +186,7 @@ private:
assert(_counter == NULL || _counter == c);
_counter = c;
if (_counter)
- ++c->count;
+ ++(c->count);
}
/** Decrement the count, delete if we're the last reference */