Skip to content

Commit

Permalink
Prevent closing QGIS while tasks are running
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Dec 5, 2016
1 parent 008817b commit 7bbc60a
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/app/qgisapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 7bbc60a

Please sign in to comment.