Skip to content

Commit acd619f

Browse files
author
jef
committed
fix #1678
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@10748 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent b6ff318 commit acd619f

File tree

1 file changed

+18
-16
lines changed

1 file changed

+18
-16
lines changed

src/plugins/grass/qgsgrassnewmapset.cpp

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1266,26 +1266,28 @@ void QgsGrassNewMapset::createMapset()
12661266
G__setenv(( char * ) "GISDBASE", mDatabaseLineEdit->text().toAscii().data() );
12671267
#endif
12681268

1269+
int ret = 0;
1270+
12691271
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();
12721277

1273-
if ( ret != 0 )
1278+
if ( QgsGrass::getError() == QgsGrass::FATAL || ret != 0 )
12741279
{
12751280
QMessageBox::warning( this, tr( "Create location" ),
12761281
tr( "Cannot create new location: %1" ).arg( QgsGrass::getErrorMessage() ) );
1277-
12781282
return;
12791283
}
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()
12891291
}
12901292
else
12911293
{
@@ -1352,7 +1354,7 @@ void QgsGrassNewMapset::createMapset()
13521354
mPlugin->mapsetChanged();
13531355
}
13541356

1355-
delete this;
1357+
deleteLater();
13561358
}
13571359

13581360
void QgsGrassNewMapset::accept()
@@ -1388,7 +1390,7 @@ void QgsGrassNewMapset::keyPressEvent( QKeyEvent * e )
13881390

13891391
void QgsGrassNewMapset::pageSelected( int index )
13901392
{
1391-
QgsDebugMsg( QString( "title = %1" ).arg( page( index )->title() ) );
1393+
QgsDebugMsg( QString( "title = %1" ).arg( page( index ) ? page( index )->title() : "(null)" ) );
13921394

13931395
switch ( index )
13941396
{
@@ -1474,7 +1476,7 @@ void QgsGrassNewMapset::close( void )
14741476

14751477
hide();
14761478
mRunning = false;
1477-
delete this;
1479+
deleteLater();
14781480
}
14791481

14801482
void QgsGrassNewMapset::closeEvent( QCloseEvent *e )

0 commit comments

Comments
 (0)