Fix undefined behavior due to recursive mutex locking, and properly clear sensors when re-enumerating

This commit is contained in:
BlackMark 2022-03-28 20:15:29 +02:00
parent 392a03a23d
commit 77d9a22419

View File

@ -19,7 +19,7 @@
#include "sensor_driver.hpp"
#include "utils.hpp"
MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent)
MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent), m_mtx(QMutex::RecursionMode::Recursive)
{
qDebug(ltr("Creating main window"));
@ -54,6 +54,8 @@ void MainWindow::closeEvent(QCloseEvent* event)
void MainWindow::enumSensors()
{
m_sensors.clear();
auto sensors = enumerateSensors();
for(auto& sensor: sensors) {