Skip to content

Commit

Permalink
in case SQlite vectors wait end of rendering to avoid file lock: fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
luipir committed Oct 5, 2017
1 parent 1781cfc commit 8364b8d
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/app/qgisapp.cpp
Expand Up @@ -8003,6 +8003,32 @@ void QgisApp::saveEdits( QgsMapLayer *layer, bool leaveEditable, bool triggerRep
if ( vlayer == activeLayer() )
mSaveRollbackInProgress = true;

// wait for end of rendering to avoid lock in case of
// splilte and gpkg fix #15498
// Wait only if the current layer is in the rendering pool
if ( mMapCanvas->mapSettings().layers().contains( vlayer->id() ) )
{
if ( vlayer->dataProvider()->storageType().count( "SQLite" ) )
{
// notify wait the rendering end
if ( mMapCanvas->isDrawing() )
{
// notify
QgsMessageBarItem *item = new QgsMessageBarItem( tr( "Save edit paused" ),
tr( "Waiting for end of rendering" ),
QgsMessageBar::WARNING, 0 );
messageBar()->pushItem( item );
// wait
while ( mMapCanvas->isDrawing() )
{
QgsApplication::instance()->processEvents( QEventLoop::AllEvents, 100 );
}
// remove wait message
messageBar()->popWidget( item );
}
}
}

if ( !vlayer->commitChanges() )
{
mSaveRollbackInProgress = false;
Expand Down

0 comments on commit 8364b8d

Please sign in to comment.