From a2d40b20128a7d15532c2c45fd86c38968861880 Mon Sep 17 00:00:00 2001 From: Mads Marquart Date: Wed, 20 Jul 2022 05:39:58 +0200 Subject: [PATCH] Reborrow a few places where now necessary See https://github.com/madsmtm/objc2/pull/150 for a bit of background --- src/input/appkit.rs | 10 +++++----- src/view/controller/appkit.rs | 8 ++++---- src/view/controller/uikit.rs | 8 ++++---- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/input/appkit.rs b/src/input/appkit.rs index 02683991..11417cda 100644 --- a/src/input/appkit.rs +++ b/src/input/appkit.rs @@ -13,25 +13,25 @@ use crate::utils::load; /// Called when editing this text field has ended (e.g. user pressed enter). extern "C" fn text_did_end_editing(this: &mut Object, _: Sel, _info: id) { let view = load::(this, TEXTFIELD_DELEGATE_PTR); - let s = NSString::retain(unsafe { msg_send![this, stringValue] }); + let s = NSString::retain(unsafe { msg_send![&*this, stringValue] }); view.text_did_end_editing(s.to_str()); } extern "C" fn text_did_begin_editing(this: &mut Object, _: Sel, _info: id) { let view = load::(this, TEXTFIELD_DELEGATE_PTR); - let s = NSString::retain(unsafe { msg_send![this, stringValue] }); + let s = NSString::retain(unsafe { msg_send![&*this, stringValue] }); view.text_did_begin_editing(s.to_str()); } extern "C" fn text_did_change(this: &mut Object, _: Sel, _info: id) { let view = load::(this, TEXTFIELD_DELEGATE_PTR); - let s = NSString::retain(unsafe { msg_send![this, stringValue] }); + let s = NSString::retain(unsafe { msg_send![&*this, stringValue] }); view.text_did_change(s.to_str()); } extern "C" fn text_should_begin_editing(this: &mut Object, _: Sel, _info: id) -> BOOL { let view = load::(this, TEXTFIELD_DELEGATE_PTR); - let s = NSString::retain(unsafe { msg_send![this, stringValue] }); + let s = NSString::retain(unsafe { msg_send![&*this, stringValue] }); match view.text_should_begin_editing(s.to_str()) { true => YES, @@ -41,7 +41,7 @@ extern "C" fn text_should_begin_editing(this: &mut Object, extern "C" fn text_should_end_editing(this: &mut Object, _: Sel, _info: id) -> BOOL { let view = load::(this, TEXTFIELD_DELEGATE_PTR); - let s = NSString::retain(unsafe { msg_send![this, stringValue] }); + let s = NSString::retain(unsafe { msg_send![&*this, stringValue] }); match view.text_should_end_editing(s.to_str()) { true => YES, false => NO diff --git a/src/view/controller/appkit.rs b/src/view/controller/appkit.rs index 45fb03a4..9aec40c7 100644 --- a/src/view/controller/appkit.rs +++ b/src/view/controller/appkit.rs @@ -13,7 +13,7 @@ use crate::view::{ViewDelegate, VIEW_DELEGATE_PTR}; /// Called when the view controller receives a `viewWillAppear` message. extern "C" fn will_appear(this: &mut Object, _: Sel) { unsafe { - let _: () = msg_send![super(this, class!(NSViewController)), viewWillAppear]; + let _: () = msg_send![super(&mut *this, class!(NSViewController)), viewWillAppear]; } let controller = load::(this, VIEW_DELEGATE_PTR); @@ -23,7 +23,7 @@ extern "C" fn will_appear(this: &mut Object, _: Sel) { /// Called when the view controller receives a `viewDidAppear` message. extern "C" fn did_appear(this: &mut Object, _: Sel) { unsafe { - let _: () = msg_send![super(this, class!(NSViewController)), viewDidAppear]; + let _: () = msg_send![super(&mut *this, class!(NSViewController)), viewDidAppear]; } let controller = load::(this, VIEW_DELEGATE_PTR); @@ -33,7 +33,7 @@ extern "C" fn did_appear(this: &mut Object, _: Sel) { /// Called when the view controller receives a `viewWillDisappear` message. extern "C" fn will_disappear(this: &mut Object, _: Sel) { unsafe { - let _: () = msg_send![super(this, class!(NSViewController)), viewWillDisappear]; + let _: () = msg_send![super(&mut *this, class!(NSViewController)), viewWillDisappear]; } let controller = load::(this, VIEW_DELEGATE_PTR); @@ -43,7 +43,7 @@ extern "C" fn will_disappear(this: &mut Object, _: Sel) { /// Called when the view controller receives a `viewDidDisappear` message. extern "C" fn did_disappear(this: &mut Object, _: Sel) { unsafe { - let _: () = msg_send![super(this, class!(NSViewController)), viewDidDisappear]; + let _: () = msg_send![super(&mut *this, class!(NSViewController)), viewDidDisappear]; } let controller = load::(this, VIEW_DELEGATE_PTR); diff --git a/src/view/controller/uikit.rs b/src/view/controller/uikit.rs index 9598dd51..a95f71b3 100644 --- a/src/view/controller/uikit.rs +++ b/src/view/controller/uikit.rs @@ -13,7 +13,7 @@ use crate::view::{ViewDelegate, VIEW_DELEGATE_PTR}; /// Called when the view controller receives a `viewWillAppear:` message. extern "C" fn will_appear(this: &mut Object, _: Sel, animated: BOOL) { unsafe { - let _: () = msg_send![super(this, class!(UIViewController)), viewWillAppear: animated]; + let _: () = msg_send![super(&mut *this, class!(UIViewController)), viewWillAppear: animated]; } let controller = load::(this, VIEW_DELEGATE_PTR); @@ -23,7 +23,7 @@ extern "C" fn will_appear(this: &mut Object, _: Sel, animated: /// Called when the view controller receives a `viewDidAppear:` message. extern "C" fn did_appear(this: &mut Object, _: Sel, animated: BOOL) { unsafe { - let _: () = msg_send![super(this, class!(UIViewController)), viewDidAppear: animated]; + let _: () = msg_send![super(&mut *this, class!(UIViewController)), viewDidAppear: animated]; } let controller = load::(this, VIEW_DELEGATE_PTR); @@ -33,7 +33,7 @@ extern "C" fn did_appear(this: &mut Object, _: Sel, animated: B /// Called when the view controller receives a `viewWillDisappear:` message. extern "C" fn will_disappear(this: &mut Object, _: Sel, animated: BOOL) { unsafe { - let _: () = msg_send![super(this, class!(UIViewController)), viewWillDisappear: animated]; + let _: () = msg_send![super(&mut *this, class!(UIViewController)), viewWillDisappear: animated]; } let controller = load::(this, VIEW_DELEGATE_PTR); @@ -43,7 +43,7 @@ extern "C" fn will_disappear(this: &mut Object, _: Sel, animate /// Called when the view controller receives a `viewDidDisappear:` message. extern "C" fn did_disappear(this: &mut Object, _: Sel, animated: BOOL) { unsafe { - let _: () = msg_send![super(this, class!(UIViewController)), viewDidDisappear: animated]; + let _: () = msg_send![super(&mut *this, class!(UIViewController)), viewDidDisappear: animated]; } let controller = load::(this, VIEW_DELEGATE_PTR);