Refactor SharedState so that it is no longer behind an Arc (#2573)

* Refactor SharedState so that it is no longer behind an Arc

* Always use `Window::lock_shared_state`
This commit is contained in:
Mads Marquart 2022-11-29 12:58:35 +01:00 committed by GitHub
parent 32784af3c4
commit 2a58b785fe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 55 additions and 92 deletions

View file

@ -148,7 +148,7 @@ declare_class!(
#[sel(initWithId:acceptsFirstMouse:)]
fn init_with_id(
&mut self,
window: *mut WinitWindow,
window: &WinitWindow,
accepts_first_mouse: bool,
) -> Option<&mut Self> {
let this: Option<&mut Self> = unsafe { msg_send![super(self), init] };
@ -164,10 +164,7 @@ declare_class!(
forward_key_to_app: false,
};
Ivar::write(
&mut this._ns_window,
unsafe { Id::retain(window) }.expect("non-null window"),
);
Ivar::write(&mut this._ns_window, window.retain());
Ivar::write(&mut this.state, Box::new(state));
Ivar::write(&mut this.marked_text, NSMutableAttributedString::new());
Ivar::write(&mut this.accepts_first_mouse, accepts_first_mouse);