From 82cea033bec5e1a29a8355ca0c93b8fdf8f92f0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20M=C3=B6ller?= Date: Wed, 21 Mar 2018 12:55:32 +0100 Subject: [PATCH] Clarify documentation on scoped_refptr::release. NOTRY=True Bug: None Change-Id: I063ea848eb79dfa3d14817c28c582cd5399e711b Reviewed-on: https://webrtc-review.googlesource.com/63620 Commit-Queue: Niels Moller Reviewed-by: Karl Wiberg Cr-Commit-Position: refs/heads/master@{#22551} --- rtc_base/scoped_ref_ptr.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/rtc_base/scoped_ref_ptr.h b/rtc_base/scoped_ref_ptr.h index 0f4698a256..8fefc73031 100644 --- a/rtc_base/scoped_ref_ptr.h +++ b/rtc_base/scoped_ref_ptr.h @@ -103,11 +103,11 @@ class scoped_refptr { operator T*() const { return ptr_; } T* operator->() const { return ptr_; } - // Release a pointer. - // The return value is the current pointer held by this object. - // If this object holds a null pointer, the return value is null. - // After this operation, this object will hold a null pointer, - // and will not own the object any more. + // Returns the (possibly null) raw pointer, and makes the scoped_refptr hold a + // null pointer, all without touching the reference count of the underlying + // pointed-to object. The object is still reference counted, and the caller of + // release() is now the proud owner of one reference, so it is responsible for + // calling Release() once on the object when no longer using it. T* release() { T* retVal = ptr_; ptr_ = nullptr;