From e608057304d2e4dec1a616a3af78d3755cc79119 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Wed, 3 Sep 2014 21:31:06 -0700 Subject: [PATCH] Sync a change from AMTL. --- public/amtl/am-refcounting.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/public/amtl/am-refcounting.h b/public/amtl/am-refcounting.h index 028d6df5..ea869464 100644 --- a/public/amtl/am-refcounting.h +++ b/public/amtl/am-refcounting.h @@ -55,6 +55,13 @@ class AlreadyRefed : thing_(t) { } + AlreadyRefed(const AlreadyRefed &other) + : thing_(other.thing_) + { + // If copy elision for some reason doesn't happen (for example, when + // returning from AdoptRef), just null out the source ref. + other.thing_ = NULL; + } ~AlreadyRefed() { if (thing_) thing_->Release();