[Scummvm-cvs-logs] SF.net SVN: scummvm:[33400] scummvm/trunk
lordhoto at users.sourceforge.net
lordhoto at users.sourceforge.net
Tue Jul 29 11:16:54 CEST 2008
Revision: 33400
http://scummvm.svn.sourceforge.net/scummvm/?rev=33400&view=rev
Author: lordhoto
Date: 2008-07-29 09:16:53 +0000 (Tue, 29 Jul 2008)
Log Message:
-----------
Added a reset method to SharedPtr, which allows NULLifying it.
Modified Paths:
--------------
scummvm/trunk/common/ptr.h
scummvm/trunk/test/common/ptr.h
Modified: scummvm/trunk/common/ptr.h
===================================================================
--- scummvm/trunk/common/ptr.h 2008-07-29 08:05:28 UTC (rev 33399)
+++ scummvm/trunk/common/ptr.h 2008-07-29 09:16:53 UTC (rev 33400)
@@ -171,6 +171,16 @@
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.
*/
Modified: scummvm/trunk/test/common/ptr.h
===================================================================
--- scummvm/trunk/test/common/ptr.h 2008-07-29 08:05:28 UTC (rev 33399)
+++ scummvm/trunk/test/common/ptr.h 2008-07-29 09:16:53 UTC (rev 33400)
@@ -61,6 +61,9 @@
TS_ASSERT(p1 != 0);
TS_ASSERT(p2 == 0);
+
+ p1.reset();
+ TS_ASSERT(!p1);
}
struct A {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list