Skip to content

Commit

Permalink
Followup 9508f8b, fix other potential crashes
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Aug 6, 2015
1 parent ff28e6a commit b7187ed
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/app/qgsattributetabledialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ void QgsAttributeTableDialog::runFieldCalculation( QgsVectorLayer* layer, QStrin

int rownum = 1;

const QgsField &fld = layer->fields()[ fieldindex ];
QgsField fld = layer->fields()[ fieldindex ];

//go through all the features and change the new attributes
QgsFeatureIterator fit = layer->getFeatures( request );
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgsfieldcalculator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ void QgsFieldCalculator::accept()
bool useGeometry = exp.needsGeometry();
int rownum = 1;

const QgsField& field = mVectorLayer->fields()[mAttributeId];
QgsField field = mVectorLayer->fields()[mAttributeId];

bool newField = !mUpdateExistingGroupBox->isChecked();
QVariant emptyAttribute;
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgsidentifyresultsdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1455,7 +1455,7 @@ void QgsIdentifyResultsDialog::attributeValueChanged( QgsFeatureId fid, int idx,
if ( idx >= vlayer->fields().size() )
return;

const QgsField &fld = vlayer->fields().at( idx );
QgsField fld = vlayer->fields().at( idx );

for ( int i = 0; i < layItem->childCount(); i++ )
{
Expand Down
2 changes: 1 addition & 1 deletion src/gui/attributetable/qgsattributetablemodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ QVariant QgsAttributeTableModel::data( const QModelIndex &index, int role ) cons
if ( role == FieldIndexRole )
return fieldId;

const QgsField& field = layer()->fields().at( fieldId );
QgsField field = layer()->fields().at( fieldId );

QVariant::Type fldType = field.type();
bool fldNumeric = ( fldType == QVariant::Int || fldType == QVariant::Double || fldType == QVariant::LongLong );
Expand Down
3 changes: 1 addition & 2 deletions src/gui/editorwidgets/core/qgseditorwidgetfactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,7 @@ QString QgsEditorWidgetFactory::representValue( QgsVectorLayer* vl, int fieldIdx
Q_UNUSED( cache )
Q_UNUSED( value )

const QgsField &fld = vl->fields().at( fieldIdx );
return fld.displayString( value );
return vl->fields().at( fieldIdx ).displayString( value );
}

QVariant QgsEditorWidgetFactory::createCache( QgsVectorLayer* vl, int fieldIdx, const QgsEditorWidgetConfig& config )
Expand Down

0 comments on commit b7187ed

Please sign in to comment.