From 12cc30e94d2e204368857de343202a80018fa4a0 Mon Sep 17 00:00:00 2001 From: ryoii Date: Sun, 29 Mar 2020 20:21:00 +0800 Subject: [PATCH] Graphical singe main thread for log --- .../controller/MiraiGraphicalUIController.kt | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/mirai-console-graphical/src/main/kotlin/net/mamoe/mirai/console/graphical/controller/MiraiGraphicalUIController.kt b/mirai-console-graphical/src/main/kotlin/net/mamoe/mirai/console/graphical/controller/MiraiGraphicalUIController.kt index f5e34b04d..c7cd8d082 100644 --- a/mirai-console-graphical/src/main/kotlin/net/mamoe/mirai/console/graphical/controller/MiraiGraphicalUIController.kt +++ b/mirai-console-graphical/src/main/kotlin/net/mamoe/mirai/console/graphical/controller/MiraiGraphicalUIController.kt @@ -49,14 +49,16 @@ class MiraiGraphicalUIController : Controller(), MiraiConsoleUI { } } - when (identity) { - 0L -> mainLog.apply { - add("$identityStr $message") - mainLog.trim() - } - else -> cache[identity]?.logHistory?.apply { - add("$identityStr $message") - trim() + Platform.runLater { + when (identity) { + 0L -> mainLog.apply { + add("$identityStr $message") + trim() + } + else -> cache[identity]?.logHistory?.apply { + add("$identityStr $message") + trim() + } } } }