Skip to content

Commit

Permalink
[dualview] Fix crash when adding columns with feature form open
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed Sep 2, 2013
1 parent 37f53b0 commit ebfc874
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/gui/attributetable/qgsdualview.cpp
Expand Up @@ -65,6 +65,8 @@ void QgsDualView::init( QgsVectorLayer* layer, QgsMapCanvas* mapCanvas, QgsDista
connect( layer, SIGNAL( editingStarted() ), this, SLOT( editingToggled() ) );
connect( layer, SIGNAL( beforeCommitChanges() ), this, SLOT( editingToggled() ) );
connect( layer, SIGNAL( editingStopped() ), this, SLOT( editingToggled() ) );
connect( layer, SIGNAL( attributeAdded( int ) ), this, SLOT( editingToggled() ) );
connect( layer, SIGNAL( attributeDeleted( int ) ), this, SLOT( editingToggled() ) );

initLayerCache( layer );
initModels( mapCanvas );
Expand Down Expand Up @@ -235,7 +237,7 @@ void QgsDualView::initModels( QgsMapCanvas* mapCanvas )
mFeatureListModel = new QgsFeatureListModel( mFilterModel, mFilterModel );
}

void QgsDualView::on_mFeatureList_currentEditSelectionChanged( const QgsFeature &feat )
void QgsDualView::on_mFeatureList_currentEditSelectionChanged( QgsFeature &feat )
{
if ( !feat.isValid() )
return;
Expand All @@ -249,6 +251,9 @@ void QgsDualView::on_mFeatureList_currentEditSelectionChanged( const QgsFeature
mAttributeEditorLayout->removeWidget( mAttributeDialog->dialog() );
}

if ( feat.attributes().count() != mLayerCache->layer()->pendingFields().count() )
mLayerCache->featureAtId( feat.id(), feat );

mAttributeDialog = new QgsAttributeDialog( mLayerCache->layer(), new QgsFeature( feat ), true, mDistanceArea, this, false );
mAttributeEditorLayout->addWidget( mAttributeDialog->dialog() );
mAttributeDialog->dialog()->setVisible( true );
Expand Down
2 changes: 1 addition & 1 deletion src/gui/attributetable/qgsdualview.h
Expand Up @@ -171,7 +171,7 @@ class GUI_EXPORT QgsDualView : public QStackedWidget, private Ui::QgsDualViewBas
*
* @param feat The newly visible feature
*/
void on_mFeatureList_currentEditSelectionChanged( const QgsFeature &feat );
void on_mFeatureList_currentEditSelectionChanged( QgsFeature& feat );

void previewExpressionBuilder();

Expand Down

0 comments on commit ebfc874

Please sign in to comment.