[llvm-commits] [llvm] r144931 - /llvm/trunk/include/llvm/ADT/IntrusiveRefCntPtr.h
Ted Kremenek
kremenek at apple.com
Thu Nov 17 15:02:14 PST 2011
Author: kremenek
Date: Thu Nov 17 17:02:14 2011
New Revision: 144931
URL: http://llvm.org/viewvc/llvm-project?rev=144931&view=rev
Log:
Fix bug in RefCountedBase/RefCountedBaseVPTR where the reference count was accidentally copied as part of the copy constructor. This could result in objects getting leaked because there reference count was too high.
Modified:
llvm/trunk/include/llvm/ADT/IntrusiveRefCntPtr.h
Modified: llvm/trunk/include/llvm/ADT/IntrusiveRefCntPtr.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/IntrusiveRefCntPtr.h?rev=144931&r1=144930&r2=144931&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/IntrusiveRefCntPtr.h (original)
+++ llvm/trunk/include/llvm/ADT/IntrusiveRefCntPtr.h Thu Nov 17 17:02:14 2011
@@ -46,6 +46,7 @@
public:
RefCountedBase() : ref_cnt(0) {}
+ RefCountedBase(const RefCountedBase &) : ref_cnt(0) {}
void Retain() const { ++ref_cnt; }
void Release() const {
@@ -67,6 +68,8 @@
protected:
RefCountedBaseVPTR() : ref_cnt(0) {}
+ RefCountedBaseVPTR(const RefCountedBaseVPTR &) : ref_cnt(0) {}
+
virtual ~RefCountedBaseVPTR() {}
void Retain() const { ++ref_cnt; }
More information about the llvm-commits
mailing list