When closing a program, it runs the following code block
connect(ui->actionExit, &QAction::triggered, [&]() {
s.setValue("mainWindowGeometry", saveGeometry());
s.setValue("mainWindowState", saveState());
qApp->quit();
});
connect(ui->actionExit, &QAction::triggered, [&]() {
QSettings s;
s.setValue("mainWindowGeometry", saveGeometry());
s.setValue("mainWindowState", saveState());
qApp->quit();
});
To copy to clipboard, switch view to plain text mode
but sometimes the application will still hang around in the background and I have to kill it through task manager.
I suspect that this is related to various QtConcurrent::run() and QEventLoop::exec() calls. If I use exit(0) or qApp->exit(0) rather than qApp->quit() the application seems to exit more frequently but it still ends up hanging.
Is there a better way to approach exiting an application that will prevent it from hanging around in the background?
Bookmarks