Skip to content

Commit

Permalink
fix: #67 软件卡死问题
Browse files Browse the repository at this point in the history
  • Loading branch information
chenxuuu committed Jul 29, 2022
1 parent 1059813 commit 64fbbc9
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions llcom/View/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -918,12 +918,16 @@ private void LuaApis_PrintLuaLog(object sender, EventArgs e)
luaLogCount++;
if(luaLogCount < 1000)
{
this.Dispatcher.Invoke(new Action(delegate
//新起一个线程,绕过线程锁卡死问题
Task.Run(() =>
{
luaLogTextBox.Select(luaLogTextBox.Text.Length, 0);//确保文字不再被选中,防止wpf卡死
luaLogTextBox.AppendText((sender as string) + "\r\n");
luaLogTextBox.ScrollToEnd();
}));
this.Dispatcher.Invoke(new Action(delegate
{
luaLogTextBox.Select(luaLogTextBox.Text.Length, 0);//确保文字不再被选中,防止wpf卡死
luaLogTextBox.AppendText((sender as string) + "\r\n");
luaLogTextBox.ScrollToEnd();
}));
});
}
else
{
Expand Down

0 comments on commit 64fbbc9

Please sign in to comment.