Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: compiled/intrusive_ptr.h

Issue 29385742: Issue 4127 - [emscripten] Convert subscription classes to C++ - Part 2 (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore
Patch Set: Created March 16, 2017, 6:27 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
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();
}

Powered by Google App Engine
This is Rietveld