Retain calayer after creation (#546)
* Retain calayer after creation * Fix fmt * fix create_calayer test
This commit is contained in:
+17
-1
@@ -65,7 +65,11 @@ impl CALayer {
|
||||
|
||||
#[inline]
|
||||
pub fn new() -> CALayer {
|
||||
unsafe { CALayer(msg_send![class!(CALayer), layer]) }
|
||||
unsafe {
|
||||
let id: id = msg_send![class!(CALayer), layer];
|
||||
let _: id = msg_send![id, retain];
|
||||
CALayer(id)
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
@@ -1680,3 +1684,15 @@ 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() {
|
||||
objc::rc::autoreleasepool(|| {
|
||||
let _ = CALayer::new();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user