From aacf00f3b6976d8dfb50004bc2912296f03a3ee8 Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Mon, 28 Sep 2020 14:02:21 -0700 Subject: [PATCH] Make scoped_nsprotocol::release() private. (flutter/engine#21467) This is not used anywhere in the engine. However, this API is easy to misuse as one might incorrectly assume that it releases the reference on the underlying object. Callers must use `reset` for this purpose. --- .../flutter/fml/platform/darwin/scoped_nsobject.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/engine/src/flutter/fml/platform/darwin/scoped_nsobject.h b/engine/src/flutter/fml/platform/darwin/scoped_nsobject.h index 50b08ebb36..34d966c8a3 100644 --- a/engine/src/flutter/fml/platform/darwin/scoped_nsobject.h +++ b/engine/src/flutter/fml/platform/darwin/scoped_nsobject.h @@ -76,6 +76,12 @@ class scoped_nsprotocol { object_ = temp; } + // Shift reference to the autorelease pool to be released later. + NST autorelease() { return [release() autorelease]; } + + private: + NST object_; + // scoped_nsprotocol<>::release() is like scoped_ptr<>::release. It is NOT a // wrapper for [object_ release]. To force a scoped_nsprotocol<> to call // [object_ release], use scoped_nsprotocol<>::reset(). @@ -84,12 +90,6 @@ class scoped_nsprotocol { object_ = nil; return temp; } - - // Shift reference to the autorelease pool to be released later. - NST autorelease() { return [release() autorelease]; } - - private: - NST object_; }; // Free functions