Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Do not crash when removing a layer with attr table open
.. in show features in current extent mode.
Cherry picked from master d62087e
- Loading branch information
Showing
with
22 additions
and
18 deletions.
-
+22
−18
src/gui/attributetable/qgsattributetablemodel.cpp
|
@@ -429,32 +429,36 @@ void QgsAttributeTableModel::loadLayer() |
|
|
removeRows( 0, rowCount() ); |
|
|
} |
|
|
|
|
|
QgsFeatureIterator features = mLayerCache->getFeatures( mFeatureRequest ); |
|
|
|
|
|
int i = 0; |
|
|
// Layer might have been deleted and cache set to nullptr! |
|
|
if ( mLayerCache ) |
|
|
{ |
|
|
QgsFeatureIterator features = mLayerCache->getFeatures( mFeatureRequest ); |
|
|
|
|
|
QTime t; |
|
|
t.start(); |
|
|
int i = 0; |
|
|
|
|
|
while ( features.nextFeature( mFeat ) ) |
|
|
{ |
|
|
++i; |
|
|
QTime t; |
|
|
t.start(); |
|
|
|
|
|
if ( t.elapsed() > 1000 ) |
|
|
while ( features.nextFeature( mFeat ) ) |
|
|
{ |
|
|
bool cancel = false; |
|
|
emit progress( i, cancel ); |
|
|
if ( cancel ) |
|
|
break; |
|
|
++i; |
|
|
|
|
|
t.restart(); |
|
|
if ( t.elapsed() > 1000 ) |
|
|
{ |
|
|
bool cancel = false; |
|
|
emit progress( i, cancel ); |
|
|
if ( cancel ) |
|
|
break; |
|
|
|
|
|
t.restart(); |
|
|
} |
|
|
featureAdded( mFeat.id(), true ); |
|
|
} |
|
|
featureAdded( mFeat.id(), true ); |
|
|
} |
|
|
|
|
|
emit finished(); |
|
|
emit finished(); |
|
|
connect( mLayerCache, &QgsVectorLayerCache::invalidated, this, &QgsAttributeTableModel::loadLayer, Qt::UniqueConnection ); |
|
|
} |
|
|
|
|
|
connect( mLayerCache, &QgsVectorLayerCache::invalidated, this, &QgsAttributeTableModel::loadLayer, Qt::UniqueConnection ); |
|
|
endResetModel(); |
|
|
} |
|
|
|
|
|