cabana: speed up exit (#29813)

This commit is contained in:
Dean Lee
2023-09-08 02:30:53 +08:00
committed by GitHub
parent 0267e0500c
commit 74daab120d
3 changed files with 12 additions and 8 deletions
+5
View File
@@ -27,6 +27,11 @@ AbstractStream::AbstractStream(QObject *parent) : QObject(parent) {
emit StreamNotifier::instance()->changingStream();
delete can;
can = this;
// TODO: add method stop() to class AbstractStream
QObject::connect(qApp, &QApplication::aboutToQuit, can, []() {
qDebug() << "stopping stream thread";
can->pause(true);
});
emit StreamNotifier::instance()->streamStarted();
});
}
+7 -7
View File
@@ -159,13 +159,13 @@ Slider::Slider(QWidget *parent) : thumbnail_label(parent), QSlider(Qt::Horizonta
qlog_future = std::make_unique<QFuture<void>>(QtConcurrent::run(this, &Slider::parseQLog));
}
});
}
Slider::~Slider() {
abort_parse_qlog = true;
if (qlog_future) {
qlog_future->waitForFinished();
}
QObject::connect(qApp, &QApplication::aboutToQuit, [this]() {
abort_parse_qlog = true;
if (qlog_future && qlog_future->isRunning()) {
qDebug() << "stopping thumbnail thread";
qlog_future->waitForFinished();
}
});
}
AlertInfo Slider::alertInfo(double seconds) {
-1
View File
@@ -37,7 +37,6 @@ class Slider : public QSlider {
public:
Slider(QWidget *parent);
~Slider();
double currentSecond() const { return value() / factor; }
void setCurrentSecond(double sec) { setValue(sec * factor); }
void setTimeRange(double min, double max);