展示优化

This commit is contained in:
2026-08-03 11:22:23 +08:00
parent b8c1360175
commit ed601608b2
3 changed files with 132 additions and 43 deletions
+30 -1
View File
@@ -1,2 +1,31 @@
#include "BackEnd.h"
#include <QMetaObject>
Back_End::~Back_End() {
stop_mock_thread();
}
void Back_End::stop_mock_thread() {
++mock_generation;
QTimer* timer = mock_timer;
mock_timer = nullptr;
if (timer) {
if (timer->thread() == QThread::currentThread()) {
timer->stop();
delete timer;
}
else if (mock_thread && mock_thread->isRunning()) {
QMetaObject::invokeMethod(timer, [timer]() {
timer->stop();
delete timer;
}, Qt::BlockingQueuedConnection);
}
else {
delete timer;
}
}
if (!mock_thread)
return;
mock_thread->quit();
mock_thread->wait();
delete mock_thread;
mock_thread = nullptr;
}