diff --git a/apps/ai-game-creator-shell/src-tauri/src/ui_editor/commands/separation/persistence.rs b/apps/ai-game-creator-shell/src-tauri/src/ui_editor/commands/separation/persistence.rs index 637722fa1..9275b5523 100644 --- a/apps/ai-game-creator-shell/src-tauri/src/ui_editor/commands/separation/persistence.rs +++ b/apps/ai-game-creator-shell/src-tauri/src/ui_editor/commands/separation/persistence.rs @@ -47,9 +47,12 @@ pub async fn write_separation_state(path: PathBuf, state: &SeparationState) -> R app_log!("ui_separation.error stage=state_write reason=schema_mismatch"); return Err("不支持的 separation state schema".to_string()); } - let state = serde_json::to_vec_pretty(state) - .map_err(|error| format!("序列化 separation state 失败:{error}"))?; - tokio::task::spawn_blocking(move || write_separation_state_blocking(&path, &state)) + let owned = state.clone(); + tokio::task::spawn_blocking(move || { + let bytes = serde_json::to_vec_pretty(&owned) + .map_err(|error| format!("序列化 separation state 失败:{error}"))?; + write_separation_state_blocking(&path, &bytes) + }) .await .map_err(|error| format!("写入 separation state 任务失败:{error}"))? }