summaryrefslogtreecommitdiffstats
path: root/src/common
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2006-06-11 23:33:00 +0000
committerDavid Robillard <d@drobilla.net>2006-06-11 23:33:00 +0000
commit0b1c17f08f8eab4ada52ee98ba7353ec0260d3eb (patch)
tree09af4447ba74f392d12f2153b432cb60be1c08ab /src/common
parent228279d6717e69ffd2d2a886244179635ac27c2b (diff)
downloadingen-0b1c17f08f8eab4ada52ee98ba7353ec0260d3eb.tar.gz
ingen-0b1c17f08f8eab4ada52ee98ba7353ec0260d3eb.tar.bz2
ingen-0b1c17f08f8eab4ada52ee98ba7353ec0260d3eb.zip
New nodes in gtk client working through Store signal interface
git-svn-id: http://svn.drobilla.net/lad/grauph@26 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/common')
-rw-r--r--src/common/util/CountedPtr.h19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/common/util/CountedPtr.h b/src/common/util/CountedPtr.h
index f2079c7c..5c2a48f0 100644
--- a/src/common/util/CountedPtr.h
+++ b/src/common/util/CountedPtr.h
@@ -52,6 +52,14 @@ public:
_counter = new Counter(p);
}
+ /** Make a NULL CountedPtr.
+ * It would be best if this didn't exist, but it makes these storable
+ * in STL containers :/
+ */
+ CountedPtr()
+ : _counter(NULL)
+ {}
+
~CountedPtr()
{
release();
@@ -61,9 +69,10 @@ public:
CountedPtr(const CountedPtr& copy)
: _counter(NULL)
{
- assert(copy);
assert(this != &copy);
- retain(copy._counter);
+
+ if (copy)
+ retain(copy._counter);
}
/** Copy a CountedPtr to a valid base class.
@@ -76,7 +85,11 @@ public:
// Fail if this is not a valid cast
if (y) {
- T* const unused_variable = static_cast<Y* const>(y._counter->ptr);
+#ifdef WITH_RTTI
+ T* const unused_variable = dynamic_cast<T* const>(y._counter->ptr);
+#else
+ T* const unused_variable = static_cast<T* const>(y._counter->ptr);
+#endif
assert(unused_variable == y._counter->ptr); // shuts up gcc
}