Skip to content

Commit 8364b8d

Browse files
committedOct 5, 2017
in case SQlite vectors wait end of rendering to avoid file lock: fixes #15498
1 parent 1781cfc commit 8364b8d

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed
 

‎src/app/qgisapp.cpp

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8003,6 +8003,32 @@ void QgisApp::saveEdits( QgsMapLayer *layer, bool leaveEditable, bool triggerRep
80038003
if ( vlayer == activeLayer() )
80048004
mSaveRollbackInProgress = true;
80058005

8006+
// wait for end of rendering to avoid lock in case of
8007+
// splilte and gpkg fix #15498
8008+
// Wait only if the current layer is in the rendering pool
8009+
if ( mMapCanvas->mapSettings().layers().contains( vlayer->id() ) )
8010+
{
8011+
if ( vlayer->dataProvider()->storageType().count( "SQLite" ) )
8012+
{
8013+
// notify wait the rendering end
8014+
if ( mMapCanvas->isDrawing() )
8015+
{
8016+
// notify
8017+
QgsMessageBarItem *item = new QgsMessageBarItem( tr( "Save edit paused" ),
8018+
tr( "Waiting for end of rendering" ),
8019+
QgsMessageBar::WARNING, 0 );
8020+
messageBar()->pushItem( item );
8021+
// wait
8022+
while ( mMapCanvas->isDrawing() )
8023+
{
8024+
QgsApplication::instance()->processEvents( QEventLoop::AllEvents, 100 );
8025+
}
8026+
// remove wait message
8027+
messageBar()->popWidget( item );
8028+
}
8029+
}
8030+
}
8031+
80068032
if ( !vlayer->commitChanges() )
80078033
{
80088034
mSaveRollbackInProgress = false;

0 commit comments

Comments
 (0)
Please sign in to comment.