diff --git a/.changes/windows-drag-drop.md b/.changes/windows-drag-drop.md new file mode 100644 index 000000000..ca9db563e --- /dev/null +++ b/.changes/windows-drag-drop.md @@ -0,0 +1,5 @@ +--- +"wry": "patch" +--- + +On Windows, fix file drop handler. diff --git a/src/webview2/mod.rs b/src/webview2/mod.rs index cdb53bd4a..aab68b5f4 100644 --- a/src/webview2/mod.rs +++ b/src/webview2/mod.rs @@ -176,15 +176,15 @@ impl InnerWebView { ) -> Result { let _ = unsafe { CoInitializeEx(None, COINIT_APARTMENTTHREADED) }; - let file_drop_controller = attributes - .file_drop_handler - .take() - .map(|handler| FileDropController::new(hwnd, handler)); + let file_drop_handler = attributes.file_drop_handler.take(); let env = Self::create_environment(&web_context, pl_attrs.clone(), &attributes)?; let controller = Self::create_controller(hwnd, &env, attributes.incognito)?; let webview = Self::init_webview(hwnd, attributes, &env, &controller, pl_attrs)?; + let file_drop_controller = + file_drop_handler.map(|handler| FileDropController::new(hwnd, handler)); + Ok(Self { hwnd, controller,