fix: Borrow-Checker in Background-Sync-Thread
Temporary-Drop-Order: MutexGuard hielt Referenz auf State-Binding, das am Block-Ende schon fallen gelassen wurde. Zwischenvariable erzwingt Drop der MutexGuard vor dem Binding. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
6aad986d78
commit
5ba007ef51
|
|
@ -525,7 +525,8 @@ fn start_background_sync(
|
|||
// takes effect without restarting the thread.
|
||||
let paths_now = {
|
||||
let state = app_sync.state::<AppState>();
|
||||
state.sync_paths.lock().unwrap().clone()
|
||||
let p = state.sync_paths.lock().unwrap().clone();
|
||||
p
|
||||
};
|
||||
if paths_now.is_empty() {
|
||||
// Nothing to sync - idle quietly.
|
||||
|
|
@ -538,11 +539,13 @@ fn start_background_sync(
|
|||
let _ = app_sync.emit("sync-status", "syncing");
|
||||
|
||||
// Refresh engine's API token from state (token may have been refreshed)
|
||||
{
|
||||
let fresh_token: Option<String> = {
|
||||
let state = app_sync.state::<AppState>();
|
||||
if let Some(ref api) = *state.api.lock().unwrap() {
|
||||
engine.api.access_token = api.access_token.clone();
|
||||
}
|
||||
let t = state.api.lock().unwrap().as_ref().map(|a| a.access_token.clone());
|
||||
t
|
||||
};
|
||||
if let Some(t) = fresh_token {
|
||||
engine.api.access_token = t;
|
||||
}
|
||||
|
||||
match rt.block_on(engine.sync_all()) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue