Skip to content
Permalink
Browse files
Bugfix: when saving a project and there is insufficient space on the …
…volume, handle the problem gracefully. Also fixed qgisapp so that failed project saving before app exiting halts app exit properly

git-svn-id: http://svn.osgeo.org/qgis/trunk@9456 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
timlinux committed Oct 8, 2008
1 parent 3a83999 commit ce29a2f3a0717062db702fe1c263f91ac1d49960
Showing with 14 additions and 0 deletions.
  1. +2 −0 src/app/qgisapp.cpp
  2. +12 −0 src/core/qgsproject.cpp
@@ -3133,13 +3133,15 @@ bool QgisApp::fileSave()
QMessageBox::critical( this,
tr( "Unable to save project" ),
tr( "Unable to save project to " ) + QgsProject::instance()->fileName() );
return false;
}
}
catch ( std::exception & e )
{
QMessageBox::critical( this,
tr( "Unable to save project " ) + QgsProject::instance()->fileName(),
QString::fromLocal8Bit( e.what() ) );
return false;
}
return true;
} // QgisApp::fileSave
@@ -1015,6 +1015,18 @@ bool QgsProject::write()
doc->save( projectFileStream, 4 ); // save as utf-8
imp_->file.close();

// check if the text stream had no error - if it does
// the user will get a message so they can try to resolve the
// situation e.g. by saving project to a volume with more space
//
if ( projectFileStream.pos() == -1 || imp_->file.error() != QFile::NoError)
{
throw QgsIOException( QObject::tr( "Unable to save to file. Your project "
"may be corrupted on disk. Try clearing some space on the volume and "
"check file permissions before pressing save again." ) +
imp_->file.fileName() );
return false;
}

dirty( false ); // reset to pristine state

0 comments on commit ce29a2f

Please sign in to comment.