fix: build loi E0505 - khong move handle vao closure khi dang borrow

run_on_main_thread(&self, FnOnce) borrow handle; closure move can ban clone
rieng (handle_for_closure) de goi dialog() ben trong.
This commit is contained in:
2026-08-09 13:20:17 +00:00
parent cacd072f3e
commit 9f7af1e1b6
+4 -1
View File
@@ -183,10 +183,13 @@ pub fn run() {
// Dialog phai chay tren main thread (GTK/Windows message loop)
let handle = app_handle.clone();
let resp_for_main = resp.clone();
// Clone rieng cho closure: run_on_main_thread(&self, F)
// borrow `handle`, closure (move) phai dung ban clone.
let handle_for_closure = handle.clone();
let _ = handle.run_on_main_thread(move || {
// tauri-plugin-dialog v2: blocking_pick_folder() tra
// Option<FilePath> (enum Path(PathBuf) | Url(Url))
let picked: Option<FilePath> = handle
let picked: Option<FilePath> = handle_for_closure
.dialog()
.file()
.blocking_pick_folder();