Skip to content

Commit

Permalink
Make scoped_nsprotocol::release() private. (#21467)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
chinmaygarde authored Sep 28, 2020
1 parent b133df3 commit f3d7a76
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions fml/platform/darwin/scoped_nsobject.h
Original file line number Diff line number Diff line change
Expand Up @@ -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().
Expand All @@ -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
Expand Down

0 comments on commit f3d7a76

Please sign in to comment.