blckngm / webview2

Rust bindings for WebView2
MIT License
73 stars 12 forks source link

`NewWindowRequestedEventArgs.get_new_window()` causes panic in closure. #15

Closed Marekkon5 closed 3 years ago

Marekkon5 commented 3 years ago

Hello, I am trying to close the window opened by dropping a file onto webview. I've used the winit example, and just added handler for new window request inside the Enviromnent builder:

webview.add_new_window_requested(|w, a| {
    if let Ok(w) = a.get_new_window() {
        println!("TEST");
    }
    Ok(())
}).ok();

The program crashes right after dropping a file with:

thread 'main' panicked at 'ComPtr's ptr was null', C:\Users\vm\.cargo\registry\src\github.com-1ecc6299db9ec823\com-0.2.0\src\ptr.rs:48:36
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
webview2: panic in callback function. Aborting because it's UB to unwind across FFI boundaries.
error: process didn't exit successfully: `target\debug\edge.exe` (exit code: 0xc0000409, STATUS_STACK_BUFFER_OVERRUN)

Thank you.