Skip to content

Commit 8e23fdf

Browse files
committed
Document why NSView.window is safe
1 parent d1080ea commit 8e23fdf

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

framework-crates/objc2-app-kit/translation-config.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,11 @@ class.NSPanel.methods."initWithContentRect:styleMask:backing:defer:screen:".unsa
468468
class.NSView.methods."setCanDrawConcurrently:".unsafe = true
469469
class.NSWindow.methods."setAllowsConcurrentViewDrawing:".unsafe = true
470470

471-
# TODO(breaking): Might need to be unsafe, if this is truly unretained?
471+
# This is `unsafe_unretained`, but `NSWindow` sets it on its child views upon
472+
# deallocation (and there is no exposed `setWindow:` method), so it will
473+
# always either be a valid window, or NULL.
474+
#
475+
# (It's effectively a weak pointer).
472476
class.NSView.methods.window.unsafe = false
473477

474478
# Documentation says that you shouldn't create cycles (though unsure if UB?).

0 commit comments

Comments
 (0)