Skip to content

Commit

Permalink
Fix browser example
Browse files Browse the repository at this point in the history
  • Loading branch information
silvanshade committed Aug 22, 2023
1 parent 3d9b686 commit 60e90b6
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions crates/icrate/examples/browser.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#![deny(unsafe_op_in_unsafe_fn)]
#![cfg_attr(not(target_os = "macos"), allow(unused))]
use std::ptr::NonNull;

use icrate::{
ns_string,
Expand Down Expand Up @@ -40,15 +42,16 @@ declare_class!(
#[method(initWithTextField:andWebView:)]
#[allow(non_snake_case)]
unsafe fn __init_withTextField_andWebView(
self: &mut Self,
this: *mut Self,
text_field: &NSTextField,
web_view: &WKWebView,
) -> Option<&mut Self> {
let this: Option<&mut Self> = msg_send![super(self), init];
let this = this?;
Ivar::write(&mut this.text_field, text_field.retain());
Ivar::write(&mut this.web_view, web_view.retain());
Some(this)
) -> Option<NonNull<Self>> {
let this: Option<&mut Self> = msg_send![super(this), init];
this.map(|this| {
Ivar::write(&mut this.text_field, text_field.retain());
Ivar::write(&mut this.web_view, web_view.retain());
NonNull::from(this)
})
}
}

Expand Down

0 comments on commit 60e90b6

Please sign in to comment.