Skip to content
Permalink
Browse files

Prevent closing QGIS while tasks are running

  • Loading branch information
nyalldawson committed Dec 5, 2016
1 parent 008817b commit 7bbc60a135d6a2d78c91f4b36dc5661a9e867194
Showing with 18 additions and 0 deletions.
  1. +18 −0 src/app/qgisapp.cpp
@@ -4444,6 +4444,24 @@ void QgisApp::addAmsLayer( const QString& uri, const QString& typeName )

void QgisApp::fileExit()
{
if ( QgsApplication::taskManager()->countActiveTasks() > 0 )
{
QStringList tasks;
Q_FOREACH ( QgsTask* task, QgsApplication::taskManager()->activeTasks() )
{
tasks << tr( " • %1" ).arg( task->description() );
}

// active tasks
if ( QMessageBox::question( this, tr( "Active tasks" ),
tr( "The following tasks are currently running in the background:\n\n%1\n\nDo you want to try cancelling these active tasks?" ).arg( tasks.join( "\n" ) ),
QMessageBox::Yes | QMessageBox::No ) == QMessageBox::Yes )
{
QgsApplication::taskManager()->cancelAll();
}
return;
}

if ( saveDirty() )
{
closeProject();

0 comments on commit 7bbc60a

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