Skip to content

Commit

Permalink
Merge pull request #180 from rust-windowing/fix-double-free
Browse files Browse the repository at this point in the history
macOS: Fix double-free of `NSWindow`
  • Loading branch information
madsmtm authored Nov 15, 2023
2 parents 800f640 + f198b22 commit ac92d53
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Unreleased

- MacOS: Fix double-free of `NSWindow`.

# 0.4.0

- **Breaking:** Port to use `raw-window-handle` v0.6.(#132)
Expand Down
3 changes: 2 additions & 1 deletion src/cg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ impl<D: HasDisplayHandle, W: HasWindowHandle> CGImpl<D, W> {
_ => return Err(InitError::Unsupported(window_src)),
};
let view = handle.ns_view.as_ptr() as id;
let window = unsafe { msg_send![view, window] };
let window: id = unsafe { msg_send![view, window] };
let window: id = unsafe { msg_send![window, retain] };
let layer = CALayer::new();
unsafe {
let subview: id = NSView::alloc(nil).initWithFrame_(NSView::frame(view));
Expand Down

0 comments on commit ac92d53

Please sign in to comment.