--- a/src/misc/autoptr.hpp Fri Aug 03 19:16:36 2007 +0000
+++ b/src/misc/autoptr.hpp Fri Aug 03 22:09:42 2007 +0000
@@ -45,7 +45,7 @@
}
/** give-up ownership and NULLify the raw pointer */
- FORCEINLINE T* Release()
+ FORCEINLINE T* Detach()
{
T* p = m_p;
m_p = NULL;
@@ -81,8 +81,16 @@
/** assignment operator */
FORCEINLINE AutoPtrT& operator = (const AutoPtrT& src)
{
+ /* Save original pointer and replace it with the given one to avoid recursive calls. */
+ T* p = m_p;
m_p = src.m_p;
+
if (m_p != NULL) src.m_p = NULL;
+
+ if (p != NULL) {
+ /* Now we can safely delete the old one. */
+ delete p;
+ }
return *this;
}