Skip to content
Permalink
Browse files
QThreadPool::cancel was introduced in Qt5.5, so no cancellation
possible for Qt < 5.5

Moral of the story: if you run outdated libraries, you can't
expect full functionality from your apps ;)
  • Loading branch information
nyalldawson committed Dec 5, 2016
1 parent 5216220 commit 9b763741b89b5fd252cd159a2d820986b7085917
Showing with 9 additions and 1 deletion.
  1. +9 −1 src/core/qgstaskmanager.cpp
@@ -83,9 +83,14 @@ void QgsTask::run()

void QgsTask::cancel()
{
mShouldTerminate = true;
#if QT_VERSION < 0x050500
//can't cancel with qt < 5.5
return;
#else

mShouldTerminate = true;
QThreadPool::globalInstance()->cancel( this );

if ( mStatus == Queued || mStatus == OnHold )
{
// immediately terminate unstarted jobs
@@ -100,6 +105,7 @@ void QgsTask::cancel()
{
subTask.task->cancel();
}
#endif
}

void QgsTask::hold()
@@ -694,7 +700,9 @@ bool QgsTaskManager::cleanupAndDeleteTask( QgsTask *task )
}
else
{
#if QT_VERSION >= 0x050500
QThreadPool::globalInstance()->cancel( task );
#endif
if ( isParent )
{
//task already finished, kill it

0 comments on commit 9b76374

Please sign in to comment.