展示优化
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user