Skip to content

Commit

Permalink
fix(macos): crash when reading on drop callback pointer
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasfernog-crabnebula committed Dec 11, 2023
1 parent dc4d73e commit 60dd638
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions crates/drag/src/platform_impl/macos/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ pub fn start_drag<W: HasRawWindowHandle, F: Fn(DragResult) + Send + 'static>(
let source: id = msg_send![cls, alloc];
let source: id = msg_send![source, init];

let on_drop_callback = Box::new(on_drop_callback) as Box<dyn Fn(DragResult) + Send>;
let callback_ptr = Box::into_raw(Box::new(on_drop_callback));
(*source).set_ivar("on_drop_ptr", callback_ptr as *mut _ as *mut c_void);

Expand Down

0 comments on commit 60dd638

Please sign in to comment.