Skip to content

Commit 98d5a76

Browse files
committed
fix for crash in projection selection
1 parent 641bd67 commit 98d5a76

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

src/gui/qgsprojectionselector.cpp

+9-5
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ QgsProjectionSelector::QgsProjectionSelector( QWidget* parent, const char *name,
3737
: QWidget( parent, fl )
3838
, mProjListDone( false )
3939
, mUserProjListDone( false )
40+
, mRecentProjListDone( false )
4041
, mCRSNameSelectionPending( false )
4142
, mCRSIDSelectionPending( false )
4243
, mAuthIDSelectionPending( false )
@@ -168,10 +169,12 @@ void QgsProjectionSelector::showEvent( QShowEvent * theEvent )
168169
applySelection();
169170
}
170171

171-
lstRecent->clear();
172-
173-
for ( int i = mRecentProjections.size() - 1; i >= 0; i-- )
174-
insertRecent( mRecentProjections.at( i ).toLong() );
172+
if ( !mRecentProjListDone )
173+
{
174+
for ( int i = mRecentProjections.size() - 1; i >= 0; i-- )
175+
insertRecent( mRecentProjections.at( i ).toLong() );
176+
mRecentProjListDone = true;
177+
}
175178

176179
// Pass up the inheritance hierarchy
177180
QWidget::showEvent( theEvent );
@@ -859,7 +862,8 @@ void QgsProjectionSelector::on_cbxHideDeprecated_stateChanged()
859862
void QgsProjectionSelector::on_lstRecent_currentItemChanged( QTreeWidgetItem *current, QTreeWidgetItem *previous )
860863
{
861864
Q_UNUSED( previous );
862-
setSelectedCrsId( current->text( QGIS_CRS_ID_COLUMN ).toLong() );
865+
if ( current )
866+
setSelectedCrsId( current->text( QGIS_CRS_ID_COLUMN ).toLong() );
863867
}
864868

865869
void QgsProjectionSelector::on_pbnFind_clicked()

src/gui/qgsprojectionselector.h

+3
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,9 @@ class GUI_EXPORT QgsProjectionSelector: public QWidget, private Ui::QgsProjectio
187187
//! Has the User Projection List been populated?
188188
bool mUserProjListDone;
189189

190+
//! Has the Recent Projection List been populated?
191+
bool mRecentProjListDone;
192+
190193
//! Is there a pending selection to be made by CRS Name?
191194
bool mCRSNameSelectionPending;
192195

0 commit comments

Comments
 (0)