From 0b1c17f08f8eab4ada52ee98ba7353ec0260d3eb Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 11 Jun 2006 23:33:00 +0000 Subject: 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 --- src/common/util/CountedPtr.h | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'src/common') 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 != ©); - 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._counter->ptr); +#ifdef WITH_RTTI + T* const unused_variable = dynamic_cast(y._counter->ptr); +#else + T* const unused_variable = static_cast(y._counter->ptr); +#endif assert(unused_variable == y._counter->ptr); // shuts up gcc } -- cgit v1.2.1