mac: retain the NSWindow to ensure that the call to retrieving the backing scale factor in set_buffer works
This commit is contained in:
parent
2832a6e42b
commit
4c6631c764
1 changed files with 9 additions and 0 deletions
|
|
@ -22,6 +22,7 @@ pub struct CGImpl {
|
||||||
impl CGImpl {
|
impl CGImpl {
|
||||||
pub unsafe fn new(handle: AppKitWindowHandle) -> Result<Self, SoftBufferError> {
|
pub unsafe fn new(handle: AppKitWindowHandle) -> Result<Self, SoftBufferError> {
|
||||||
let window = handle.ns_window as id;
|
let window = handle.ns_window as id;
|
||||||
|
let window: id = msg_send![window, retain];
|
||||||
let view = handle.ns_view as id;
|
let view = handle.ns_view as id;
|
||||||
let layer = CALayer::new();
|
let layer = CALayer::new();
|
||||||
unsafe {
|
unsafe {
|
||||||
|
|
@ -71,3 +72,11 @@ impl CGImpl {
|
||||||
transaction::commit();
|
transaction::commit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Drop for CGImpl {
|
||||||
|
fn drop(&mut self) {
|
||||||
|
unsafe {
|
||||||
|
let _: () = msg_send![self.window, release];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue