Repository: tauri-apps/wry (language: rust)

Issue:
Dragging crashes app with objc exception
**Describe the bug**
When dragging things in the webview the app crashes, with the unrecognised selector exception pointing to [this selector](https://github.com/tauri-apps/wry/blame/dev/src/webview/wkwebview/file_drop.rs#L118) not existing.

```
2023-02-03 21:47:50.732 tauri-app[3805:12199058] -[WryWebView draggingLocation]: unrecognized selector sent to instance 0x148f65ab0
thread 'main' panicked at 'Uncaught exception <NSException: 0x148fac820>', /Users/jonaskruckenberg/.cargo/registry/src/github.com-1ecc6299db9ec823/wry-0.26.0/src/webview/wkwebview/file_drop.rs:118:30
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
libc++abi: terminating with uncaught foreign exception
```

**Steps To Reproduce**
1. Run the [minimal repro app](https://github.com/JonasKruckenberg/wry-drag-crash-repro/settings)
2. Start to drag one of icons
3. see it crash

**Expected behavior**
No crash 😄 

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Platform and Versions (please complete the following information):**
OS: macOS Ventura 13.1
Rustc: rustc 1.67.0 (fc594f156 2023-01-24)

**Would you want to assign yourself to resolve this bug?**
- [ ] Yes
- [ ] No
- [x] Maybe? (I just don't think this method even exists)
 
**Additional context**
Add any other context about the problem here.


Dragging crashes app with objc exception
**Describe the bug**
When dragging things in the webview the app crashes, with the unrecognised selector exception pointing to [this selector](https://github.com/tauri-apps/wry/blame/dev/src/webview/wkwebview/file_drop.rs#L118) not existing.

```
2023-02-03 21:47:50.732 tauri-app[3805:12199058] -[WryWebView draggingLocation]: unrecognized selector sent to instance 0x148f65ab0
thread 'main' panicked at 'Uncaught exception <NSException: 0x148fac820>', /Users/jonaskruckenberg/.cargo/registry/src/github.com-1ecc6299db9ec823/wry-0.26.0/src/webview/wkwebview/file_drop.rs:118:30
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
libc++abi: terminating with uncaught foreign exception
```

**Steps To Reproduce**
1. Run the [minimal repro app](https://github.com/JonasKruckenberg/wry-drag-crash-repro/settings)
2. Start to drag one of icons
3. see it crash

**Expected behavior**
No crash 😄 

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Platform and Versions (please complete the following information):**
OS: macOS Ventura 13.1
Rustc: rustc 1.67.0 (fc594f156 2023-01-24)

**Would you want to assign yourself to resolve this bug?**
- [ ] Yes
- [ ] No
- [x] Maybe? (I just don't think this method even exists)
 
**Additional context**
Add any other context about the problem here.




Discussion / hints:

Fix patch:
diff --git a/.changes/drag_pos.md b/.changes/drag_pos.md
new file mode 100644
index 000000000..53c764eb6
--- /dev/null
+++ b/.changes/drag_pos.md
@@ -0,0 +1,6 @@
+---
+"wry": patch
+---
+
+On macOS, fix crash when getting dragging position.
+
diff --git a/src/webview/wkwebview/file_drop.rs b/src/webview/wkwebview/file_drop.rs
index fb5ebd5cf..36992eb92 100644
--- a/src/webview/wkwebview/file_drop.rs
+++ b/src/webview/wkwebview/file_drop.rs
@@ -115,7 +115,7 @@ extern "C" fn dragging_entered(this: &mut Object, sel: Sel, drag_info: id) -> NS
   let listener = unsafe { get_handler(this) };
   let paths = unsafe { collect_paths(drag_info) };
 
-  let dl: NSPoint = unsafe { msg_send![this, draggingLocation] };
+  let dl: NSPoint = unsafe { msg_send![drag_info, draggingLocation] };
   let scale_factor = listener.1.scale_factor();
   let ns_window = listener.1.ns_window() as id;
   let frame: NSRect = unsafe { msg_send![ns_window, frame] };
@@ -134,7 +134,7 @@ extern "C" fn perform_drag_operation(this: &mut Object, sel: Sel, drag_info: id)
   let listener = unsafe { get_handler(this) };
   let paths = unsafe { collect_paths(drag_info) };
 
-  let dl: NSPoint = unsafe { msg_send![this, draggingLocation] };
+  let dl: NSPoint = unsafe { msg_send![drag_info, draggingLocation] };
   let scale_factor = listener.1.scale_factor();
   let ns_window = listener.1.ns_window() as id;
   let frame: NSRect = unsafe { msg_send![ns_window, frame] };


Test patch: