diff --git a/src/librssguard/core/feeddownloader.cpp b/src/librssguard/core/feeddownloader.cpp index 39a47bb5a..a43c195cf 100644 --- a/src/librssguard/core/feeddownloader.cpp +++ b/src/librssguard/core/feeddownloader.cpp @@ -157,7 +157,12 @@ void FeedDownloader::updateFeeds(const QList& feeds) { return updateThreadedFeed(fd); }; - m_watcherLookup.setFuture(QtConcurrent::mapped(qApp->workHorsePool(), m_feeds, func)); + m_watcherLookup.setFuture(QtConcurrent::mapped( +#if QT_VERSION_MAJOR > 5 + qApp->workHorsePool(), +#endif + m_feeds, + func)); } } diff --git a/src/librssguard/miscellaneous/application.cpp b/src/librssguard/miscellaneous/application.cpp index 5c9fea744..6c3ce8e4f 100644 --- a/src/librssguard/miscellaneous/application.cpp +++ b/src/librssguard/miscellaneous/application.cpp @@ -967,6 +967,14 @@ void Application::setupWorkHorsePool() { // NOTE: Do not expire threads so that their IDs are not reused. // This fixes cross-thread QSqlDatabase access. m_workHorsePool->setExpiryTimeout(-1); + +#if QT_VERSION_MAJOR == 5 + // NOTE: Qt 5 sadly does not allow to specify custom thread pool for + // QtConcurrent::mapped() method, so we have to use global thread pool + // there. + QThreadPool::globalInstance()->setMaxThreadCount(m_workHorsePool->maxThreadCount()); + QThreadPool::globalInstance()->setExpiryTimeout(m_workHorsePool->expiryTimeout()); +#endif } void Application::onAdBlockFailure() { diff --git a/src/librssguard/services/standard/standardfeedsimportexportmodel.cpp b/src/librssguard/services/standard/standardfeedsimportexportmodel.cpp index 6ba872faf..cbcf13739 100644 --- a/src/librssguard/services/standard/standardfeedsimportexportmodel.cpp +++ b/src/librssguard/services/standard/standardfeedsimportexportmodel.cpp @@ -380,7 +380,11 @@ void FeedsImportExportModel::importAsOPML20(const QByteArray& data, return produceFeed(lookup); }; +#if QT_VERSION_MAJOR == 5 + QFuture fut = QtConcurrent::mapped(m_lookup, func); +#else QFuture fut = QtConcurrent::mapped(qApp->workHorsePool(), m_lookup, func); +#endif m_watcherLookup.setFuture(fut); @@ -445,7 +449,11 @@ void FeedsImportExportModel::importAsTxtURLPerLine(const QByteArray& data, return produceFeed(lookup); }; +#if QT_VERSION_MAJOR == 5 + QFuture fut = QtConcurrent::mapped(m_lookup, func); +#else QFuture fut = QtConcurrent::mapped(qApp->workHorsePool(), m_lookup, func); +#endif m_watcherLookup.setFuture(fut);