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:
@@ -183,10 +183,13 @@ pub fn run() {
|
|||||||
// Dialog phai chay tren main thread (GTK/Windows message loop)
|
// Dialog phai chay tren main thread (GTK/Windows message loop)
|
||||||
let handle = app_handle.clone();
|
let handle = app_handle.clone();
|
||||||
let resp_for_main = resp.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 || {
|
let _ = handle.run_on_main_thread(move || {
|
||||||
// tauri-plugin-dialog v2: blocking_pick_folder() tra
|
// tauri-plugin-dialog v2: blocking_pick_folder() tra
|
||||||
// Option<FilePath> (enum Path(PathBuf) | Url(Url))
|
// Option<FilePath> (enum Path(PathBuf) | Url(Url))
|
||||||
let picked: Option<FilePath> = handle
|
let picked: Option<FilePath> = handle_for_closure
|
||||||
.dialog()
|
.dialog()
|
||||||
.file()
|
.file()
|
||||||
.blocking_pick_folder();
|
.blocking_pick_folder();
|
||||||
|
|||||||
Reference in New Issue
Block a user