Skip to content

Commit

Permalink
Fix for a crash in projection selection
Browse files Browse the repository at this point in the history
  • Loading branch information
wonder-sk authored and mach0 committed Dec 3, 2011
1 parent 8b77d31 commit 05e70ff
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/gui/qgsprojectionselector.cpp
Expand Up @@ -34,14 +34,16 @@ const int NAME_COLUMN = 0;
const int AUTHID_COLUMN = 1;
const int QGIS_CRS_ID_COLUMN = 2;

QgsProjectionSelector::QgsProjectionSelector( QWidget* parent, const char * name, Qt::WFlags fl )
QgsProjectionSelector::QgsProjectionSelector( QWidget* parent, const char *name, Qt::WFlags fl )
: QWidget( parent, fl )
, mProjListDone( false )
, mUserProjListDone( false )
, mRecentProjListDone( false )
, mCRSNameSelectionPending( false )
, mCRSIDSelectionPending( false )
, mAuthIDSelectionPending( false )
{
Q_UNUSED( name );
setupUi( this );
connect( lstCoordinateSystems, SIGNAL( currentItemChanged( QTreeWidgetItem*, QTreeWidgetItem* ) ),
this, SLOT( coordinateSystemSelected( QTreeWidgetItem* ) ) );
Expand Down Expand Up @@ -168,10 +170,12 @@ void QgsProjectionSelector::showEvent( QShowEvent * theEvent )
applySelection();
}

lstRecent->clear();

for ( int i = mRecentProjections.size() - 1; i >= 0; i-- )
insertRecent( mRecentProjections.at( i ).toLong() );
if ( !mRecentProjListDone )
{
for ( int i = mRecentProjections.size() - 1; i >= 0; i-- )
insertRecent( mRecentProjections.at( i ).toLong() );
mRecentProjListDone = true;
}

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

void QgsProjectionSelector::on_lstRecent_currentItemChanged( QTreeWidgetItem *current, QTreeWidgetItem *previous )
{
Q_UNUSED( previous );
if ( current )
{
setSelectedCrsId( current->text( QGIS_CRS_ID_COLUMN ).toLong() );
}
}

void QgsProjectionSelector::on_pbnFind_clicked()
Expand Down
3 changes: 3 additions & 0 deletions src/gui/qgsprojectionselector.h
Expand Up @@ -187,6 +187,9 @@ class GUI_EXPORT QgsProjectionSelector: public QWidget, private Ui::QgsProjectio
//! Has the User Projection List been populated?
bool mUserProjListDone;

//! Has the Recent Projection List been populated?
bool mRecentProjListDone;

//! Is there a pending selection to be made by CRS Name?
bool mCRSNameSelectionPending;

Expand Down

0 comments on commit 05e70ff

Please sign in to comment.