From e23c99bf653a4bff78ca7aa0672d75e916a32a35 Mon Sep 17 00:00:00 2001 From: syntheticpp Date: Wed, 17 May 2006 16:04:32 +0000 Subject: [PATCH] undo commit 1.29, reject bug: [ 1459838 ] Loki::COMRefCounted doesn't call AddRef() on assignment git-svn-id: svn://svn.code.sf.net/p/loki-lib/code/trunk@646 7ec92016-0320-0410-acc4-a06ded1c099a --- include/loki/SmartPtr.h | 62 ++++++++--------------------------------- 1 file changed, 12 insertions(+), 50 deletions(-) diff --git a/include/loki/SmartPtr.h b/include/loki/SmartPtr.h index 376ef26..f21887f 100644 --- a/include/loki/SmartPtr.h +++ b/include/loki/SmartPtr.h @@ -260,15 +260,7 @@ namespace Loki assert(pCount_!=0); *pCount_ = 1; } - - RefCounted( const P & ) - : pCount_(static_cast( - SmallObject<>::operator new(sizeof(uintptr_t)))) - { - assert(pCount_!=0); - *pCount_ = 1; - } - + RefCounted(const RefCounted& rhs) : pCount_(rhs.pCount_) {} @@ -337,16 +329,6 @@ namespace Loki ThreadingModel::AtomicAssign(*pCount_, 1); } - RefCountedMT( const P & ) - { - pCount_ = static_cast( - SmallObject::operator new( - sizeof(*pCount_))); - assert(pCount_); - //*pCount_ = 1; - ThreadingModel::AtomicAssign(*pCount_, 1); - } - RefCountedMT(const RefCountedMT& rhs) : pCount_(rhs.pCount_) {} @@ -400,13 +382,7 @@ namespace Loki public: COMRefCounted() {} - - COMRefCounted(const P& val) - { - if(val!=0) - val->AddRef(); - } - + template COMRefCounted(const COMRefCounted&) {} @@ -445,10 +421,7 @@ namespace Loki { DeepCopy() {} - - DeepCopy( const P & ) - {} - + template DeepCopy(const DeepCopy&) {} @@ -508,10 +481,7 @@ namespace Loki public: RefLinked() {} - - RefLinked( const P & ) - {} - + template RefLinked(const RefLinked& rhs) : Private::RefLinkedBase(rhs) @@ -544,10 +514,7 @@ namespace Loki public: DestructiveCopy() {} - - DestructiveCopy( const P & ) - {} - + template DestructiveCopy(const DestructiveCopy&) {} @@ -583,10 +550,7 @@ namespace Loki public: NoCopy() {} - - NoCopy( const P & ) - {} - + template NoCopy(const NoCopy&) {} @@ -655,8 +619,6 @@ namespace Loki /// Well, it's clear what it does :o) //////////////////////////////////////////////////////////////////////////////// - template < class P > struct AssertCheck; - template struct NoCheck { @@ -667,10 +629,6 @@ namespace Loki NoCheck(const NoCheck&) {} - template - NoCheck(const AssertCheck&) - {} - static void OnDefault(const P&) {} @@ -1005,10 +963,10 @@ namespace Loki { KP::OnDefault(GetImpl(*this)); } explicit - SmartPtr(ExplicitArg p) : SP(p), OP(p) + SmartPtr(ExplicitArg p) : SP(p) { KP::OnInit(GetImpl(*this)); } - SmartPtr(ImplicitArg p) : SP(p), OP(p) + SmartPtr(ImplicitArg p) : SP(p) { KP::OnInit(GetImpl(*this)); } SmartPtr(CopyArg& rhs) @@ -1561,7 +1519,11 @@ namespace std #endif // SMARTPTR_INC_ + // $Log$ +// Revision 1.30 2006/05/17 16:04:32 syntheticpp +// undo commit 1.29, reject bug: [ 1459838 ] Loki::COMRefCounted doesn't call AddRef() on assignment +// // Revision 1.29 2006/04/05 22:41:43 rich_sposato // Fixed bug 1459838 using fix made by Thomas Albrecht. (Thanks!) // Also added a constructor for NoCheck policy.