Fix NSTextField string dealloc bug
This commit is contained in:
parent
8a9c45af61
commit
5f2f1f21b0
|
@ -13,7 +13,7 @@ use crate::utils::load;
|
||||||
/// Called when editing this text field has ended (e.g. user pressed enter).
|
/// Called when editing this text field has ended (e.g. user pressed enter).
|
||||||
extern "C" fn text_did_end_editing<T: TextFieldDelegate>(this: &mut Object, _: Sel, _info: id) {
|
extern "C" fn text_did_end_editing<T: TextFieldDelegate>(this: &mut Object, _: Sel, _info: id) {
|
||||||
let view = load::<T>(this, TEXTFIELD_DELEGATE_PTR);
|
let view = load::<T>(this, TEXTFIELD_DELEGATE_PTR);
|
||||||
let s = NSString::from_retained(unsafe { msg_send![this, stringValue] });
|
let s = NSString::retain(unsafe { msg_send![this, stringValue] });
|
||||||
view.text_did_end_editing(s.to_str());
|
view.text_did_end_editing(s.to_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ extern "C" fn text_should_end_editing<T: TextFieldDelegate>(
|
||||||
_info: id,
|
_info: id,
|
||||||
) -> BOOL {
|
) -> BOOL {
|
||||||
let view = load::<T>(this, TEXTFIELD_DELEGATE_PTR);
|
let view = load::<T>(this, TEXTFIELD_DELEGATE_PTR);
|
||||||
let s = NSString::from_retained(unsafe { msg_send![this, stringValue] });
|
let s = NSString::retain(unsafe { msg_send![this, stringValue] });
|
||||||
match view.text_should_end_editing(s.to_str()) {
|
match view.text_should_end_editing(s.to_str()) {
|
||||||
true => YES,
|
true => YES,
|
||||||
false => NO
|
false => NO
|
||||||
|
|
Loading…
Reference in a new issue