Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "qvwin32functions.h"

#include <QCommandLineParser>
#include <QThreadPool>

int main(int argc, char *argv[])
{
Expand Down Expand Up @@ -35,5 +36,8 @@ int main(int argc, char *argv[])
if (!parser.positionalArguments().isEmpty())
QVApplication::openFile(window, parser.positionalArguments().constFirst(), true);

return QApplication::exec();
const int ret = QApplication::exec();
// Background tasks create QPixmaps; they must finish while the application object still exists.
QThreadPool::globalInstance()->waitForDone();
return ret;
}
7 changes: 3 additions & 4 deletions src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -440,10 +440,9 @@ void MainWindow::disableActions()

void MainWindow::requestPopulateOpenWithMenu()
{
openWithFutureWatcher.setFuture(QtConcurrent::run([&] {
const auto &curFilePath = getCurrentFileDetails().fileInfo.absoluteFilePath();
return OpenWith::getOpenWithItems(curFilePath);
}));
const QString curFilePath = getCurrentFileDetails().fileInfo.absoluteFilePath();
openWithFutureWatcher.setFuture(QtConcurrent::run(
[curFilePath] { return OpenWith::getOpenWithItems(curFilePath); }));
}

void MainWindow::populateOpenWithMenu(const QList<OpenWith::OpenWithItem> openWithItems)
Expand Down