diff --git a/.changes/cleanup-redundant-clone.md b/.changes/cleanup-redundant-clone.md new file mode 100644 index 0000000..5bfec4a --- /dev/null +++ b/.changes/cleanup-redundant-clone.md @@ -0,0 +1,5 @@ +--- +"wry": patch +--- + +Remove redundant clones in WebView and download handling. No user facing changes. \ No newline at end of file diff --git a/src/lib.rs b/src/lib.rs index 6a9d8dc..9335b19 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -2386,7 +2386,7 @@ impl WebViewExtMacOS for WebView { } fn ns_window(&self) -> Retained { - self.webview.webview.window().unwrap().clone() + self.webview.webview.window().unwrap() } fn reparent(&self, window: *mut NSWindow) -> Result<()> { diff --git a/src/wkwebview/class/url_scheme_handler.rs b/src/wkwebview/class/url_scheme_handler.rs index c997a41..d047616 100644 --- a/src/wkwebview/class/url_scheme_handler.rs +++ b/src/wkwebview/class/url_scheme_handler.rs @@ -282,7 +282,7 @@ extern "C" fn start_task( .map_err(|_e| crate::Error::CustomProtocolTaskInvalid)?; check_webview_id_valid(webview_id)?; - check_task_is_valid(&webview, task_key, task_uuid.clone())?; + check_task_is_valid(&webview, task_key, task_uuid)?; objc2::exception::catch(AssertUnwindSafe(|| { task.didFinish(); diff --git a/src/wkwebview/download.rs b/src/wkwebview/download.rs index ab0952f..a9763f1 100644 --- a/src/wkwebview/download.rs +++ b/src/wkwebview/download.rs @@ -74,7 +74,7 @@ pub(crate) fn download_policy( let started_fn = &this.ivars().started; if let Some(started_fn) = started_fn { let mut started_fn = started_fn.borrow_mut(); - match started_fn(url.to_string().to_string(), &mut download_destination) { + match started_fn(url.to_string(), &mut download_destination) { true => { let path = NSString::from_str(&download_destination.display().to_string()); let ns_url = NSURL::fileURLWithPath_isDirectory(&path, false); diff --git a/src/wkwebview/mod.rs b/src/wkwebview/mod.rs index 8ea851c..a056e4e 100644 --- a/src/wkwebview/mod.rs +++ b/src/wkwebview/mod.rs @@ -570,7 +570,7 @@ impl InnerWebView { id: webview_id, mtm, webview: webview.clone(), - manager: manager.clone(), + manager, ns_view: ns_view.retain(), data_store, pending_scripts, @@ -629,7 +629,7 @@ r#"Object.defineProperty(window, 'ipc', { NSAutoresizingMaskOptions::ViewHeightSizable | NSAutoresizingMaskOptions::ViewWidthSizable, ); - parent_view.addSubview(&webview.clone()); + parent_view.addSubview(&webview); // Tell the webview receive keyboard events in the window. // See https://github.com/tauri-apps/wry/issues/739