Skip to content
Permalink
Browse files

Task manager deprecation warning fixes

  • Loading branch information
nyalldawson committed Jan 30, 2020
1 parent a2f37cc commit f9f1ad70a61cf0c8e0a019286c3cf4afe627c714
Showing with 11 additions and 4 deletions.
  1. +11 −4 src/core/qgstaskmanager.cpp
@@ -684,8 +684,11 @@ void QgsTaskManager::taskStatusChanged( int status )
mTaskMutex->lock();
QgsTaskRunnableWrapper *runnable = mTasks.value( id ).runnable;
mTaskMutex->unlock();
if ( runnable )
QThreadPool::globalInstance()->cancel( runnable );
if ( runnable && QThreadPool::globalInstance()->tryTake( runnable ) )
{
delete runnable;
mTasks[ id ].runnable = nullptr;
}

if ( status == QgsTask::Terminated || status == QgsTask::Complete )
{
@@ -788,8 +791,12 @@ bool QgsTaskManager::cleanupAndDeleteTask( QgsTask *task )
}
else
{
if ( runnable )
QThreadPool::globalInstance()->cancel( runnable );
if ( runnable && QThreadPool::globalInstance()->tryTake( runnable ) )
{
delete runnable;
mTasks[ id ].runnable = nullptr;
}

if ( isParent )
{
//task already finished, kill it

0 comments on commit f9f1ad7

Please sign in to comment.
You can’t perform that action at this time.