Skip to content

Commit 05e70ff

Browse files
wonder-skmach0
authored andcommitted
Fix for a crash in projection selection
1 parent 8b77d31 commit 05e70ff

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

src/gui/qgsprojectionselector.cpp

+10-7
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,16 @@ const int NAME_COLUMN = 0;
3434
const int AUTHID_COLUMN = 1;
3535
const int QGIS_CRS_ID_COLUMN = 2;
3636

37-
QgsProjectionSelector::QgsProjectionSelector( QWidget* parent, const char * name, Qt::WFlags fl )
37+
QgsProjectionSelector::QgsProjectionSelector( QWidget* parent, const char *name, Qt::WFlags fl )
3838
: QWidget( parent, fl )
3939
, mProjListDone( false )
4040
, mUserProjListDone( false )
41+
, mRecentProjListDone( false )
4142
, mCRSNameSelectionPending( false )
4243
, mCRSIDSelectionPending( false )
4344
, mAuthIDSelectionPending( false )
4445
{
46+
Q_UNUSED( name );
4547
setupUi( this );
4648
connect( lstCoordinateSystems, SIGNAL( currentItemChanged( QTreeWidgetItem*, QTreeWidgetItem* ) ),
4749
this, SLOT( coordinateSystemSelected( QTreeWidgetItem* ) ) );
@@ -168,10 +170,12 @@ void QgsProjectionSelector::showEvent( QShowEvent * theEvent )
168170
applySelection();
169171
}
170172

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

176180
// Pass up the inheritance hierarchy
177181
QWidget::showEvent( theEvent );
@@ -858,10 +862,9 @@ void QgsProjectionSelector::on_cbxHideDeprecated_stateChanged()
858862

859863
void QgsProjectionSelector::on_lstRecent_currentItemChanged( QTreeWidgetItem *current, QTreeWidgetItem *previous )
860864
{
865+
Q_UNUSED( previous );
861866
if ( current )
862-
{
863867
setSelectedCrsId( current->text( QGIS_CRS_ID_COLUMN ).toLong() );
864-
}
865868
}
866869

867870
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)