fixed race cons ep/eph coll, unwanted session state update crash

+ some minor code cleanup
This commit is contained in:
Hane 2025-01-15 21:47:35 +01:00
commit 59a92fa34b
7 changed files with 144 additions and 127 deletions

View file

@ -1088,7 +1088,10 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) {
mainMenuBar->addWidget(hw);
mainMenuBar->setMovable(false);
this->addToolBar(Qt::BottomToolBarArea, mainMenuBar);
/*
* Create initial endpoint widgets batch
*/
reloadEndpointWidgets();
/*
@ -1319,7 +1322,8 @@ void MainWindow::trayIconActivated(QSystemTrayIcon::ActivationReason reason) {
void MainWindow::reloadEndpointWidgets() {
size_t i = 0;
ews.resize(2);
//todo: -log flag
osh->handlersPlaybackMutex.lock();
for (size_t epwIndex = 2; i < (osh->getPlaybackEndpointHandlers().size()); i++) {
if (osh->getPlaybackEndpointHandlers().at(i)->getState() == EndpointState::ENDPOINT_ACTIVE){
log_debugcpp("EPWidget creation");
@ -1336,6 +1340,7 @@ void MainWindow::reloadEndpointWidgets() {
{ ews.push_back(epw); epw->setIndex(ews.size() - 1); }
}
}
osh->handlersPlaybackMutex.unlock();
//todo: ya no está aquí tirao como tal, y de hecho, no ha fallado de la manera arriba descrita
//pero ahora lo añado porque sí solo para garantizar que está y poder reusarlo luego lmao
widgetLayout->addItem(lastRowSpacer, i, 0);