Skip to content

Commit 7fc6b07

Browse files
committed
[GRASS] fixed crash when region is drawn outside limits
1 parent 2596315 commit 7fc6b07

File tree

1 file changed

+19
-9
lines changed

1 file changed

+19
-9
lines changed

src/plugins/grass/qgsgrassregion.cpp

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -236,14 +236,14 @@ QgsGrassRegion::QgsGrassRegion( QgisInterface *iface,
236236
connect( mRadioGroup, SIGNAL( buttonClicked( int ) ), this, SLOT( radioChanged() ) );
237237

238238
// Connect entries
239-
connect( mNorth, SIGNAL( editingFinished() ), this, SLOT( northChanged() ) );
240-
connect( mSouth, SIGNAL( editingFinished() ), this, SLOT( southChanged() ) );
241-
connect( mEast, SIGNAL( editingFinished() ), this, SLOT( eastChanged() ) );
242-
connect( mWest, SIGNAL( editingFinished() ), this, SLOT( westChanged() ) );
243-
connect( mNSRes, SIGNAL( editingFinished() ), this, SLOT( NSResChanged() ) );
244-
connect( mEWRes, SIGNAL( editingFinished() ), this, SLOT( EWResChanged() ) );
245-
connect( mRows, SIGNAL( editingFinished() ), this, SLOT( rowsChanged() ) );
246-
connect( mCols, SIGNAL( editingFinished() ), this, SLOT( colsChanged() ) );
239+
connect( mNorth, SIGNAL( textEdited( const QString & ) ), this, SLOT( northChanged() ) );
240+
connect( mSouth, SIGNAL( textEdited( const QString & ) ), this, SLOT( southChanged() ) );
241+
connect( mEast, SIGNAL( textEdited( const QString & ) ), this, SLOT( eastChanged() ) );
242+
connect( mWest, SIGNAL( textEdited( const QString & ) ), this, SLOT( westChanged() ) );
243+
connect( mNSRes, SIGNAL( textEdited( const QString & ) ), this, SLOT( NSResChanged() ) );
244+
connect( mEWRes, SIGNAL( textEdited( const QString & ) ), this, SLOT( EWResChanged() ) );
245+
connect( mRows, SIGNAL( textEdited( const QString & ) ), this, SLOT( rowsChanged() ) );
246+
connect( mCols, SIGNAL( textEdited( const QString & ) ), this, SLOT( colsChanged() ) );
247247

248248
connect( QgsGrass::instance(), SIGNAL( regionChanged() ), SLOT( reloadRegion() ) );
249249
connect( mCanvas, SIGNAL( mapToolSet( QgsMapTool * ) ), SLOT( canvasMapToolSet( QgsMapTool * ) ) );
@@ -431,12 +431,22 @@ void QgsGrassRegion::colsChanged()
431431

432432
void QgsGrassRegion::adjust()
433433
{
434+
QgsDebugMsg( "entered" );
435+
mButtonBox->button( QDialogButtonBox::Apply )->setDisabled( false );
434436
int rc = 0;
435437
if ( mRowsColsRadio->isChecked() )
436438
{
437439
rc = 1;
438440
}
439-
G_adjust_Cell_head( &mWindow, rc, rc );
441+
G_TRY
442+
{
443+
G_adjust_Cell_head( &mWindow, rc, rc );
444+
}
445+
G_CATCH( QgsGrass::Exception &e )
446+
{
447+
QgsGrass::warning( e );
448+
mButtonBox->button( QDialogButtonBox::Apply )->setDisabled( true );
449+
}
440450
}
441451

442452
void QgsGrassRegion::radioChanged()

0 commit comments

Comments
 (0)