@@ -107,20 +107,18 @@ void QgsCustomProjectionDialog::populateList()
107
107
// XXX Need to free memory from the error msg if one is set
108
108
if ( result == SQLITE_OK )
109
109
{
110
- QTreeWidgetItem *newItem = nullptr ;
111
- QString id, name, parameters;
112
110
QgsCoordinateReferenceSystem crs;
113
111
while ( sqlite3_step ( preparedStatement ) == SQLITE_ROW )
114
112
{
115
- id = QString::fromUtf8 ( ( char * ) sqlite3_column_text ( preparedStatement, 0 ) );
116
- name = QString::fromUtf8 ( ( char * ) sqlite3_column_text ( preparedStatement, 1 ) );
117
- parameters = QString::fromUtf8 ( ( char * ) sqlite3_column_text ( preparedStatement, 2 ) );
113
+ QString id = QString::fromUtf8 ( ( char * ) sqlite3_column_text ( preparedStatement, 0 ) );
114
+ QString name = QString::fromUtf8 ( ( char * ) sqlite3_column_text ( preparedStatement, 1 ) );
115
+ QString parameters = QString::fromUtf8 ( ( char * ) sqlite3_column_text ( preparedStatement, 2 ) );
118
116
119
117
crs.createFromProj4 ( parameters );
120
118
mExistingCRSnames [id] = name;
121
119
mExistingCRSparameters [id] = crs.toProj4 ();
122
120
123
- newItem = new QTreeWidgetItem ( leNameList, QStringList () );
121
+ QTreeWidgetItem * newItem = new QTreeWidgetItem ( leNameList, QStringList () );
124
122
newItem->setText ( QgisCrsNameColumn, name );
125
123
newItem->setText ( QgisCrsIdColumn, id );
126
124
newItem->setText ( QgisCrsParametersColumn, crs.toProj4 () );
@@ -332,8 +330,7 @@ void QgsCustomProjectionDialog::pbnRemove_clicked()
332
330
{
333
331
return ;
334
332
}
335
- QTreeWidgetItem *item = leNameList->takeTopLevelItem ( i );
336
- delete item;
333
+ delete leNameList->takeTopLevelItem ( i );
337
334
if ( !mCustomCRSids [i].isEmpty () )
338
335
{
339
336
mDeletedCRSs .push_back ( mCustomCRSids [i] );
@@ -372,7 +369,7 @@ void QgsCustomProjectionDialog::leNameList_currentItemChanged( QTreeWidgetItem *
372
369
373
370
void QgsCustomProjectionDialog::pbnCopyCRS_clicked ()
374
371
{
375
- QgsProjectionSelectionDialog * selector = new QgsProjectionSelectionDialog ( this );
372
+ std::unique_ptr< QgsProjectionSelectionDialog > selector = qgis::make_unique< QgsProjectionSelectionDialog > ( this );
376
373
if ( selector->exec () )
377
374
{
378
375
QgsCoordinateReferenceSystem srs = selector->crs ();
@@ -385,7 +382,6 @@ void QgsCustomProjectionDialog::pbnCopyCRS_clicked()
385
382
leNameList->currentItem ()->setText ( QgisCrsParametersColumn, srs.toProj4 () );
386
383
387
384
}
388
- delete selector;
389
385
}
390
386
391
387
void QgsCustomProjectionDialog::buttonBox_accepted ()
0 commit comments