Skip to content

Commit ac92d53

Browse files
authored
Merge pull request #180 from rust-windowing/fix-double-free
macOS: Fix double-free of `NSWindow`
2 parents 800f640 + f198b22 commit ac92d53

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# Unreleased
2+
3+
- MacOS: Fix double-free of `NSWindow`.
4+
15
# 0.4.0
26

37
- **Breaking:** Port to use `raw-window-handle` v0.6.(#132)

src/cg.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ impl<D: HasDisplayHandle, W: HasWindowHandle> CGImpl<D, W> {
4242
_ => return Err(InitError::Unsupported(window_src)),
4343
};
4444
let view = handle.ns_view.as_ptr() as id;
45-
let window = unsafe { msg_send![view, window] };
45+
let window: id = unsafe { msg_send![view, window] };
46+
let window: id = unsafe { msg_send![window, retain] };
4647
let layer = CALayer::new();
4748
unsafe {
4849
let subview: id = NSView::alloc(nil).initWithFrame_(NSView::frame(view));

0 commit comments

Comments
 (0)