0

Update the ARC documentation to point out a danger

Bug: 1280317
Change-Id: I4869af5a89e177f71d012c68c604e63ffe4f8a40
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4604441
Reviewed-by: Leonard Grey <lgrey@chromium.org>
Commit-Queue: Avi Drissman <avi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1156389}
This commit is contained in:
Avi Drissman
2023-06-12 20:11:39 +00:00
committed by Chromium LUCI CQ
parent 891a64c031
commit 68e0fd009e

@ -123,6 +123,17 @@ boilerplate. As for case 1, if the header file has Objective-C constructs (e.g.
`#import` or an `@` keyword) unguarded by `__OBJC__`, it would not compile in
C++ and therefore is not included by C++ code.
## Warning! Dangers! {#dangers}
There are some bits of AppKit that are incompatible with ARC. Apple has not
updated the documentation to call this out, so a heads-up:
When creating an `NSWindow`, you _must_ set the `.releasedWhenClosed` property
to `NO`. It's recommended that you do so immediately after creating it with
`alloc`/`init`. If you fail to do so, then closing the window will cause it to
release itself, and then when the owning pointer releases it, it will be a
double-release.
## Examples of conversion from non-ARC to ARC {#examples}
### Objective-C Classes {#examples-objc-classes}