[QGIS Commit] r10748 - trunk/qgis/src/plugins/grass

svn_qgis at osgeo.org svn_qgis at osgeo.org
Wed May 6 16:15:56 EDT 2009


Author: jef
Date: 2009-05-06 16:15:56 -0400 (Wed, 06 May 2009)
New Revision: 10748

Modified:
   trunk/qgis/src/plugins/grass/qgsgrassnewmapset.cpp
Log:
fix #1678

Modified: trunk/qgis/src/plugins/grass/qgsgrassnewmapset.cpp
===================================================================
--- trunk/qgis/src/plugins/grass/qgsgrassnewmapset.cpp	2009-05-06 18:33:02 UTC (rev 10747)
+++ trunk/qgis/src/plugins/grass/qgsgrassnewmapset.cpp	2009-05-06 20:15:56 UTC (rev 10748)
@@ -1266,26 +1266,28 @@
     G__setenv(( char * ) "GISDBASE", mDatabaseLineEdit->text().toAscii().data() );
 #endif
 
+    int ret = 0;
+
     QgsGrass::resetError();
-    int ret = G_make_location( location.toAscii().data(), &mCellHead,
-                               mProjInfo, mProjUnits, stdout );
+    if ( setjmp( QgsGrass::fatalErrorEnv() ) == 0 )
+    {
+      ret = G_make_location( location.toAscii().data(), &mCellHead, mProjInfo, mProjUnits, stdout );
+    }
+    QgsGrass::clearErrorEnv();
 
-    if ( ret != 0 )
+    if ( QgsGrass::getError() == QgsGrass::FATAL || ret != 0 )
     {
       QMessageBox::warning( this, tr( "Create location" ),
                             tr( "Cannot create new location: %1" ).arg( QgsGrass::getErrorMessage() ) );
-
       return;
     }
-    else
-    {
-      // Location created -> reset widgets
-      setLocations();
-      mSelectLocationRadioButton->setChecked( true );
-      mLocationComboBox->setItemText( mLocationComboBox->currentIndex(), location );
-      mLocationLineEdit->setText( "" );
-      locationRadioSwitched(); // calls also checkLocation()
-    }
+
+    // Location created -> reset widgets
+    setLocations();
+    mSelectLocationRadioButton->setChecked( true );
+    mLocationComboBox->setItemText( mLocationComboBox->currentIndex(), location );
+    mLocationLineEdit->setText( "" );
+    locationRadioSwitched(); // calls also checkLocation()
   }
   else
   {
@@ -1352,7 +1354,7 @@
     mPlugin->mapsetChanged();
   }
 
-  delete this;
+  deleteLater();
 }
 
 void QgsGrassNewMapset::accept()
@@ -1388,7 +1390,7 @@
 
 void QgsGrassNewMapset::pageSelected( int index )
 {
-  QgsDebugMsg( QString( "title = %1" ).arg( page( index )->title() ) );
+  QgsDebugMsg( QString( "title = %1" ).arg( page( index ) ? page( index )->title() : "(null)" ) );
 
   switch ( index )
   {
@@ -1474,7 +1476,7 @@
 
   hide();
   mRunning = false;
-  delete this;
+  deleteLater();
 }
 
 void QgsGrassNewMapset::closeEvent( QCloseEvent *e )



More information about the QGIS-commit mailing list