cabana: speed up exit (#29813)

pull/109/head
Dean Lee 2 years ago committed by GitHub
parent 0267e0500c
commit 74daab120d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      tools/cabana/streams/abstractstream.cc
  2. 14
      tools/cabana/videowidget.cc
  3. 1
      tools/cabana/videowidget.h

@ -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();
});
}

@ -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) {

@ -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);

Loading…
Cancel
Save