@@ -1266,26 +1266,28 @@ void QgsGrassNewMapset::createMapset()
1266
1266
G__setenv (( char * ) " GISDBASE" , mDatabaseLineEdit ->text ().toAscii ().data () );
1267
1267
#endif
1268
1268
1269
+ int ret = 0 ;
1270
+
1269
1271
QgsGrass::resetError ();
1270
- int ret = G_make_location ( location.toAscii ().data (), &mCellHead ,
1271
- mProjInfo , mProjUnits , stdout );
1272
+ if ( setjmp ( QgsGrass::fatalErrorEnv () ) == 0 )
1273
+ {
1274
+ ret = G_make_location ( location.toAscii ().data (), &mCellHead , mProjInfo , mProjUnits , stdout );
1275
+ }
1276
+ QgsGrass::clearErrorEnv ();
1272
1277
1273
- if ( ret != 0 )
1278
+ if ( QgsGrass::getError () == QgsGrass::FATAL || ret != 0 )
1274
1279
{
1275
1280
QMessageBox::warning ( this , tr ( " Create location" ),
1276
1281
tr ( " Cannot create new location: %1" ).arg ( QgsGrass::getErrorMessage () ) );
1277
-
1278
1282
return ;
1279
1283
}
1280
- else
1281
- {
1282
- // Location created -> reset widgets
1283
- setLocations ();
1284
- mSelectLocationRadioButton ->setChecked ( true );
1285
- mLocationComboBox ->setItemText ( mLocationComboBox ->currentIndex (), location );
1286
- mLocationLineEdit ->setText ( " " );
1287
- locationRadioSwitched (); // calls also checkLocation()
1288
- }
1284
+
1285
+ // Location created -> reset widgets
1286
+ setLocations ();
1287
+ mSelectLocationRadioButton ->setChecked ( true );
1288
+ mLocationComboBox ->setItemText ( mLocationComboBox ->currentIndex (), location );
1289
+ mLocationLineEdit ->setText ( " " );
1290
+ locationRadioSwitched (); // calls also checkLocation()
1289
1291
}
1290
1292
else
1291
1293
{
@@ -1352,7 +1354,7 @@ void QgsGrassNewMapset::createMapset()
1352
1354
mPlugin ->mapsetChanged ();
1353
1355
}
1354
1356
1355
- delete this ;
1357
+ deleteLater () ;
1356
1358
}
1357
1359
1358
1360
void QgsGrassNewMapset::accept ()
@@ -1388,7 +1390,7 @@ void QgsGrassNewMapset::keyPressEvent( QKeyEvent * e )
1388
1390
1389
1391
void QgsGrassNewMapset::pageSelected ( int index )
1390
1392
{
1391
- QgsDebugMsg ( QString ( " title = %1" ).arg ( page ( index )->title () ) );
1393
+ QgsDebugMsg ( QString ( " title = %1" ).arg ( page ( index ) ? page ( index ) ->title () : " (null) " ) );
1392
1394
1393
1395
switch ( index )
1394
1396
{
@@ -1474,7 +1476,7 @@ void QgsGrassNewMapset::close( void )
1474
1476
1475
1477
hide ();
1476
1478
mRunning = false ;
1477
- delete this ;
1479
+ deleteLater () ;
1478
1480
}
1479
1481
1480
1482
void QgsGrassNewMapset::closeEvent ( QCloseEvent *e )
0 commit comments