Skip to content
Permalink
Browse files

[dualview] Fix crash when adding columns with feature form open

  • Loading branch information
m-kuhn committed Sep 2, 2013
1 parent 37f53b0 commit ebfc874bfab55fcb8b0d4e0e479560e1aecc0408
Showing with 7 additions and 2 deletions.
  1. +6 −1 src/gui/attributetable/qgsdualview.cpp
  2. +1 −1 src/gui/attributetable/qgsdualview.h
@@ -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 );
@@ -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;
@@ -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 );
@@ -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();

0 comments on commit ebfc874

Please sign in to comment.
You can’t perform that action at this time.