Commit 67b0f270 authored by Leander Schulten's avatar Leander Schulten
Browse files

main.cpp: Stop the Modules::Controller and the AudioCaptureManager before...

main.cpp: Stop the Modules::Controller and the AudioCaptureManager before exiting the application, otherwise these threads will continue running and reading from other objects that will be destroyed.
parent 3b4969c4
Pipeline #189702 passed with stage
in 6 minutes and 34 seconds
......@@ -248,7 +248,9 @@ int main(int argc, char *argv[]) {
modolePropertyTypeList.append(_metaEnumP.key(i));
}*/
CatchingErrorApplication::connect(&app,&QGuiApplication::lastWindowClosed,[&](){
CatchingErrorApplication::connect(&app, &QGuiApplication::lastWindowClosed, [&]() {
Modules::ModuleManager::singletone()->controller().stop();
Audio::AudioCaptureManager::get().stopCapturingAndWait();
QFile savePath(settings.getJsonSettingsFilePath());
ApplicationData::saveData(savePath);
Driver::stopAndUnloadDriver();
......
......@@ -104,6 +104,9 @@ void Controller::updateSpotifyState(){
void Controller::run() noexcept{
while (run_) {
std::this_thread::sleep_for(std::chrono::milliseconds(1));
if (!run_) {
break;
}
std::unique_lock<std::mutex> l(vectorLock);
updateSpotifyState();
for(auto pb = runningProgramms.begin() ; pb != runningProgramms.end();){
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment