fix: core log thread

This commit is contained in:
arm64v8a
2023-05-19 14:15:31 +09:00
parent 7471f3354f
commit ec25e0ed00
12 changed files with 99 additions and 62 deletions

View File

@@ -210,7 +210,12 @@ int MessageBoxInfo(const QString &title, const QString &text) {
void runOnUiThread(const std::function<void()> &callback, QObject *parent) {
// any thread
auto *timer = new QTimer();
timer->moveToThread(parent == nullptr ? mainwindow->thread() : parent->thread());
auto thread = dynamic_cast<QThread *>(parent);
if (thread == nullptr) {
timer->moveToThread(parent == nullptr ? mainwindow->thread() : parent->thread());
} else {
timer->moveToThread(thread);
}
timer->setSingleShot(true);
QObject::connect(timer, &QTimer::timeout, [=]() {
// main thread