diff --git a/src/MaaWpfGui/ViewModels/UI/CopilotViewModel.cs b/src/MaaWpfGui/ViewModels/UI/CopilotViewModel.cs index 2d4c186dc8..673061a04c 100644 --- a/src/MaaWpfGui/ViewModels/UI/CopilotViewModel.cs +++ b/src/MaaWpfGui/ViewModels/UI/CopilotViewModel.cs @@ -157,7 +157,7 @@ namespace MaaWpfGui.ViewModels.UI /// private void ClearLog() { - LogItemViewModels.Clear(); + Execute.OnUIThread(() => LogItemViewModels.Clear()); } private string _filename = string.Empty; diff --git a/src/MaaWpfGui/ViewModels/UI/TaskQueueViewModel.cs b/src/MaaWpfGui/ViewModels/UI/TaskQueueViewModel.cs index d875c9cc73..0c97db6a43 100644 --- a/src/MaaWpfGui/ViewModels/UI/TaskQueueViewModel.cs +++ b/src/MaaWpfGui/ViewModels/UI/TaskQueueViewModel.cs @@ -802,9 +802,12 @@ namespace MaaWpfGui.ViewModels.UI /// private void ClearLog() { + Execute.OnUIThread(() => + { LogItemViewModels.Clear(); _logger.Information("Main windows log clear."); _logger.Information(string.Empty); + }); } ///