[QGIS Commit] r9456 - in trunk/qgis/src: app core
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Wed Oct 8 01:46:44 EDT 2008
Author: timlinux
Date: 2008-10-08 01:46:44 -0400 (Wed, 08 Oct 2008)
New Revision: 9456
Modified:
trunk/qgis/src/app/qgisapp.cpp
trunk/qgis/src/core/qgsproject.cpp
Log:
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
Modified: trunk/qgis/src/app/qgisapp.cpp
===================================================================
--- trunk/qgis/src/app/qgisapp.cpp 2008-10-08 05:41:46 UTC (rev 9455)
+++ trunk/qgis/src/app/qgisapp.cpp 2008-10-08 05:46:44 UTC (rev 9456)
@@ -3133,6 +3133,7 @@
QMessageBox::critical( this,
tr( "Unable to save project" ),
tr( "Unable to save project to " ) + QgsProject::instance()->fileName() );
+ return false;
}
}
catch ( std::exception & e )
@@ -3140,6 +3141,7 @@
QMessageBox::critical( this,
tr( "Unable to save project " ) + QgsProject::instance()->fileName(),
QString::fromLocal8Bit( e.what() ) );
+ return false;
}
return true;
} // QgisApp::fileSave
Modified: trunk/qgis/src/core/qgsproject.cpp
===================================================================
--- trunk/qgis/src/core/qgsproject.cpp 2008-10-08 05:41:46 UTC (rev 9455)
+++ trunk/qgis/src/core/qgsproject.cpp 2008-10-08 05:46:44 UTC (rev 9456)
@@ -1015,6 +1015,18 @@
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
More information about the QGIS-commit
mailing list