Skip to content

Commit e396076

Browse files
committed
Reborrow a few places where now necessary
See madsmtm/objc2#150 for a bit of background
1 parent e2eebec commit e396076

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

src/input/appkit.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,25 +13,25 @@ use crate::utils::load;
1313
/// Called when editing this text field has ended (e.g. user pressed enter).
1414
extern "C" fn text_did_end_editing<T: TextFieldDelegate>(this: &mut Object, _: Sel, _info: id) {
1515
let view = load::<T>(this, TEXTFIELD_DELEGATE_PTR);
16-
let s = NSString::retain(unsafe { msg_send![this, stringValue] });
16+
let s = NSString::retain(unsafe { msg_send![&*this, stringValue] });
1717
view.text_did_end_editing(s.to_str());
1818
}
1919

2020
extern "C" fn text_did_begin_editing<T: TextFieldDelegate>(this: &mut Object, _: Sel, _info: id) {
2121
let view = load::<T>(this, TEXTFIELD_DELEGATE_PTR);
22-
let s = NSString::retain(unsafe { msg_send![this, stringValue] });
22+
let s = NSString::retain(unsafe { msg_send![&*this, stringValue] });
2323
view.text_did_begin_editing(s.to_str());
2424
}
2525

2626
extern "C" fn text_did_change<T: TextFieldDelegate>(this: &mut Object, _: Sel, _info: id) {
2727
let view = load::<T>(this, TEXTFIELD_DELEGATE_PTR);
28-
let s = NSString::retain(unsafe { msg_send![this, stringValue] });
28+
let s = NSString::retain(unsafe { msg_send![&*this, stringValue] });
2929
view.text_did_change(s.to_str());
3030
}
3131

3232
extern "C" fn text_should_begin_editing<T: TextFieldDelegate>(this: &mut Object, _: Sel, _info: id) -> BOOL {
3333
let view = load::<T>(this, TEXTFIELD_DELEGATE_PTR);
34-
let s = NSString::retain(unsafe { msg_send![this, stringValue] });
34+
let s = NSString::retain(unsafe { msg_send![&*this, stringValue] });
3535

3636
match view.text_should_begin_editing(s.to_str()) {
3737
true => YES,
@@ -41,7 +41,7 @@ extern "C" fn text_should_begin_editing<T: TextFieldDelegate>(this: &mut Object,
4141

4242
extern "C" fn text_should_end_editing<T: TextFieldDelegate>(this: &mut Object, _: Sel, _info: id) -> BOOL {
4343
let view = load::<T>(this, TEXTFIELD_DELEGATE_PTR);
44-
let s = NSString::retain(unsafe { msg_send![this, stringValue] });
44+
let s = NSString::retain(unsafe { msg_send![&*this, stringValue] });
4545
match view.text_should_end_editing(s.to_str()) {
4646
true => YES,
4747
false => NO

src/view/controller/appkit.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use crate::view::{ViewDelegate, VIEW_DELEGATE_PTR};
1313
/// Called when the view controller receives a `viewWillAppear` message.
1414
extern "C" fn will_appear<T: ViewDelegate>(this: &mut Object, _: Sel) {
1515
unsafe {
16-
let _: () = msg_send![super(this, class!(NSViewController)), viewWillAppear];
16+
let _: () = msg_send![super(&mut *this, class!(NSViewController)), viewWillAppear];
1717
}
1818

1919
let controller = load::<T>(this, VIEW_DELEGATE_PTR);
@@ -23,7 +23,7 @@ extern "C" fn will_appear<T: ViewDelegate>(this: &mut Object, _: Sel) {
2323
/// Called when the view controller receives a `viewDidAppear` message.
2424
extern "C" fn did_appear<T: ViewDelegate>(this: &mut Object, _: Sel) {
2525
unsafe {
26-
let _: () = msg_send![super(this, class!(NSViewController)), viewDidAppear];
26+
let _: () = msg_send![super(&mut *this, class!(NSViewController)), viewDidAppear];
2727
}
2828

2929
let controller = load::<T>(this, VIEW_DELEGATE_PTR);
@@ -33,7 +33,7 @@ extern "C" fn did_appear<T: ViewDelegate>(this: &mut Object, _: Sel) {
3333
/// Called when the view controller receives a `viewWillDisappear` message.
3434
extern "C" fn will_disappear<T: ViewDelegate>(this: &mut Object, _: Sel) {
3535
unsafe {
36-
let _: () = msg_send![super(this, class!(NSViewController)), viewWillDisappear];
36+
let _: () = msg_send![super(&mut *this, class!(NSViewController)), viewWillDisappear];
3737
}
3838

3939
let controller = load::<T>(this, VIEW_DELEGATE_PTR);
@@ -43,7 +43,7 @@ extern "C" fn will_disappear<T: ViewDelegate>(this: &mut Object, _: Sel) {
4343
/// Called when the view controller receives a `viewDidDisappear` message.
4444
extern "C" fn did_disappear<T: ViewDelegate>(this: &mut Object, _: Sel) {
4545
unsafe {
46-
let _: () = msg_send![super(this, class!(NSViewController)), viewDidDisappear];
46+
let _: () = msg_send![super(&mut *this, class!(NSViewController)), viewDidDisappear];
4747
}
4848

4949
let controller = load::<T>(this, VIEW_DELEGATE_PTR);

src/view/controller/uikit.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use crate::view::{ViewDelegate, VIEW_DELEGATE_PTR};
1313
/// Called when the view controller receives a `viewWillAppear:` message.
1414
extern "C" fn will_appear<T: ViewDelegate>(this: &mut Object, _: Sel, animated: BOOL) {
1515
unsafe {
16-
let _: () = msg_send![super(this, class!(UIViewController)), viewWillAppear: animated];
16+
let _: () = msg_send![super(&mut *this, class!(UIViewController)), viewWillAppear: animated];
1717
}
1818

1919
let controller = load::<T>(this, VIEW_DELEGATE_PTR);
@@ -23,7 +23,7 @@ extern "C" fn will_appear<T: ViewDelegate>(this: &mut Object, _: Sel, animated:
2323
/// Called when the view controller receives a `viewDidAppear:` message.
2424
extern "C" fn did_appear<T: ViewDelegate>(this: &mut Object, _: Sel, animated: BOOL) {
2525
unsafe {
26-
let _: () = msg_send![super(this, class!(UIViewController)), viewDidAppear: animated];
26+
let _: () = msg_send![super(&mut *this, class!(UIViewController)), viewDidAppear: animated];
2727
}
2828

2929
let controller = load::<T>(this, VIEW_DELEGATE_PTR);
@@ -33,7 +33,7 @@ extern "C" fn did_appear<T: ViewDelegate>(this: &mut Object, _: Sel, animated: B
3333
/// Called when the view controller receives a `viewWillDisappear:` message.
3434
extern "C" fn will_disappear<T: ViewDelegate>(this: &mut Object, _: Sel, animated: BOOL) {
3535
unsafe {
36-
let _: () = msg_send![super(this, class!(UIViewController)), viewWillDisappear: animated];
36+
let _: () = msg_send![super(&mut *this, class!(UIViewController)), viewWillDisappear: animated];
3737
}
3838

3939
let controller = load::<T>(this, VIEW_DELEGATE_PTR);
@@ -43,7 +43,7 @@ extern "C" fn will_disappear<T: ViewDelegate>(this: &mut Object, _: Sel, animate
4343
/// Called when the view controller receives a `viewDidDisappear:` message.
4444
extern "C" fn did_disappear<T: ViewDelegate>(this: &mut Object, _: Sel, animated: BOOL) {
4545
unsafe {
46-
let _: () = msg_send![super(this, class!(UIViewController)), viewDidDisappear: animated];
46+
let _: () = msg_send![super(&mut *this, class!(UIViewController)), viewDidDisappear: animated];
4747
}
4848

4949
let controller = load::<T>(this, VIEW_DELEGATE_PTR);

0 commit comments

Comments
 (0)