Index: compiled/intrusive_ptr.h |
=================================================================== |
--- a/compiled/intrusive_ptr.h |
+++ b/compiled/intrusive_ptr.h |
@@ -48,21 +48,21 @@ template<typename T, |
class intrusive_ptr |
{ |
public: |
explicit intrusive_ptr() |
: mPointer(nullptr) |
{ |
} |
- explicit intrusive_ptr(T* pointer) |
+ explicit intrusive_ptr(T* pointer, bool addRef = true) |
: mPointer(pointer) |
{ |
- // Raw pointers always had their reference count increased by whatever gave |
- // us the pointer so we don't need to do it here. |
Wladimir Palant
2017/03/16 18:31:23
This comment turned out to be wrong and the previo
|
+ if (mPointer && addRef) |
+ mPointer->AddRef(); |
} |
explicit intrusive_ptr(const intrusive_ptr& other) |
: mPointer(other.mPointer) |
{ |
if (mPointer) |
mPointer->AddRef(); |
} |