mirror of
https://github.com/MatsuriDayo/nekoray.git
synced 2025-12-18 04:54:38 +03:00
fix: core log thread
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user