aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common/ptr.h10
-rw-r--r--test/common/ptr.h3
2 files changed, 13 insertions, 0 deletions
diff --git a/common/ptr.h b/common/ptr.h
index eea3c39882..9879db28a6 100644
--- a/common/ptr.h
+++ b/common/ptr.h
@@ -171,6 +171,16 @@ public:
bool unique() const { return refCount() == 1; }
/**
+ * Resets the SharedPtr object to a NULL pointer.
+ */
+ void reset() {
+ decRef();
+ _deletion = 0;
+ _refCount = 0;
+ _pointer = 0;
+ }
+
+ /**
* Returns the number of references to the assigned pointer.
* This should just be used for debugging purposes.
*/
diff --git a/test/common/ptr.h b/test/common/ptr.h
index 11ed52d4b9..986330057c 100644
--- a/test/common/ptr.h
+++ b/test/common/ptr.h
@@ -61,6 +61,9 @@ class PtrTestSuite : public CxxTest::TestSuite
TS_ASSERT(p1 != 0);
TS_ASSERT(p2 == 0);
+
+ p1.reset();
+ TS_ASSERT(!p1);
}
struct A {