mirror of
https://github.com/rust-windowing/winit.git
synced 2026-06-27 23:23:14 -04:00
Fix some invalid msg_send! usage (#2138)
* Fix some invalid msg_send! usage * Make the implementation of superclass clearer
This commit is contained in:
@@ -40,10 +40,9 @@ impl IdRef {
|
||||
IdRef(inner)
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn retain(inner: id) -> IdRef {
|
||||
if inner != nil {
|
||||
let () = unsafe { msg_send![inner, retain] };
|
||||
let _: id = unsafe { msg_send![inner, retain] };
|
||||
}
|
||||
IdRef(inner)
|
||||
}
|
||||
@@ -76,10 +75,7 @@ impl Deref for IdRef {
|
||||
|
||||
impl Clone for IdRef {
|
||||
fn clone(&self) -> IdRef {
|
||||
if self.0 != nil {
|
||||
let _: id = unsafe { msg_send![self.0, retain] };
|
||||
}
|
||||
IdRef(self.0)
|
||||
IdRef::retain(self.0)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -118,8 +114,8 @@ pub unsafe fn app_name() -> Option<id> {
|
||||
}
|
||||
|
||||
pub unsafe fn superclass<'a>(this: &'a Object) -> &'a Class {
|
||||
let superclass: id = msg_send![this, superclass];
|
||||
&*(superclass as *const _)
|
||||
let superclass: *const Class = msg_send![this, superclass];
|
||||
&*superclass
|
||||
}
|
||||
|
||||
pub unsafe fn create_input_context(view: id) -> IdRef {
|
||||
|
||||
Reference in New Issue
Block a user