Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix crash on layer save/rollback
Context objects should always be used in lamda connects, or
the connection has a potentially infinite lifetime!
  • Loading branch information
nyalldawson committed Oct 16, 2018
1 parent 2069dc7 commit 0a628ff
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/app/qgsattributetabledialog.cpp
Expand Up @@ -114,14 +114,14 @@ QgsAttributeTableDialog::QgsAttributeTableDialog( QgsVectorLayer *layer, QgsAttr
connect( mMainView, &QgsDualView::showContextMenuExternally, this, &QgsAttributeTableDialog::showContextMenu );

// Block/unblock table updates (feature cache signals)
connect( QgisApp::instance(), &QgisApp::attributeTableUpdateBlocked, [ = ]( const QgsVectorLayer * layer, const bool blocked )
connect( QgisApp::instance(), &QgisApp::attributeTableUpdateBlocked, this, [ = ]( const QgsVectorLayer * layer, const bool blocked )
{
if ( layer == mLayer )
this->blockCacheUpdateSignals( blocked );
} );
// Massive rollbacks can also freeze the GUI due to the feature cache signals
connect( mLayer, &QgsVectorLayer::beforeRollBack, [ = ] { this->blockCacheUpdateSignals( true ); } );
connect( mLayer, &QgsVectorLayer::afterRollBack, [ = ] { this->blockCacheUpdateSignals( false ); } );
connect( mLayer, &QgsVectorLayer::beforeRollBack, this, [ = ] { this->blockCacheUpdateSignals( true ); } );
connect( mLayer, &QgsVectorLayer::afterRollBack, this, [ = ] { this->blockCacheUpdateSignals( false ); } );

const QgsFields fields = mLayer->fields();
for ( const QgsField &field : fields )
Expand Down

0 comments on commit 0a628ff

Please sign in to comment.