Skip to content

Commit

Permalink
Retain calayer after creation
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaopengli89 committed Apr 21, 2023
1 parent 30ffd6a commit c4ea1f4
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion cocoa/src/quartzcore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ impl CALayer {
#[inline]
pub fn new() -> CALayer {
unsafe {
CALayer(msg_send![class!(CALayer), layer])
let id: id = msg_send![class!(CALayer), layer];
let _: id = msg_send![id, retain];
CALayer(id)
}
}

Expand Down Expand Up @@ -1857,3 +1859,13 @@ pub type CVSMPTETimeFlags = u32;

pub const kCVSMPTETimeValid: CVSMPTETimeFlags = 1 << 0;
pub const kCVSMPTETimeRunning: CVSMPTETimeFlags = 1 << 1;

#[cfg(test)]
mod test {
use super::CALayer;

#[test]
fn create_calayer() {
let _ = CALayer::new();
}
}

0 comments on commit c4ea1f4

Please sign in to comment.