| Index: compiled/intrusive_ptr.h |
| =================================================================== |
| --- a/compiled/intrusive_ptr.h |
| +++ b/compiled/intrusive_ptr.h |
| @@ -65,21 +65,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. |
| + if (mPointer && addRef) |
| + mPointer->AddRef(); |
| } |
| intrusive_ptr(const intrusive_ptr& other) |
| : mPointer(other.mPointer) |
| { |
| if (mPointer) |
| mPointer->AddRef(); |
| } |