Bug report #15137

Vector file remains locked after delete QgsVectorLayer object

Added by Jakub Kosik over 4 years ago. Updated over 4 years ago.

Status:Closed
Priority:Severe/Regression
Assignee:Even Rouault
Category:Data Provider/OGR
Affected QGIS version:2.14.3 Regression?:No
Operating System:Windows Easy fix?:No
Pull Request or Patch supplied:No Resolution:fixed/implemented
Crashes QGIS or corrupts data:No Copied to github as #:23076

Description

I use lot of temp files for loading data.
sample code:

shutil.copy(source_gml, gml_path+'/temp/file.gml')
gml_layer = QgsVectorLayer(gml_path+'/temp/file.gml', "gml_layer", "ogr")
gml_iter = gml_layer .getFeatures()
for gml_feature in gml_iter :
(...)some work here(...)
*del gml_layer*
shutil.rmtree(gml_path+"/temp")

Problem is with gml, shp files, I didn't try other.
Code is working fine in 2.8.2, so it is regression.

Associated revisions

Revision 2d825bcd
Added by Even Rouault over 4 years ago

[OGR provider] Make sure to release dangling connections on provider closing

Fixes #15137

Revision 4ad50a70
Added by Even Rouault over 4 years ago

[Spatialite provider] Make sure to release dangling connections on provider closing

Fixes #15137

Revision 55f172b3
Added by Even Rouault over 4 years ago

[OGR provider] Make sure to release dangling connections on provider closing

Fixes #15137

Revision c237ba71
Added by Even Rouault over 4 years ago

[Spatialite provider] Make sure to release dangling connections on provider closing

Fixes #15137

History

#1 Updated by Even Rouault over 4 years ago

  • Assignee set to Even Rouault

#2 Updated by Even Rouault over 4 years ago

  • Status changed from Open to Closed

#3 Updated by Even Rouault over 4 years ago

  • Resolution set to fixed/implemented
  • % Done changed from 0 to 100
  • Category changed from Python plugins to Data Provider/OGR

This also affected Spatialite. Fixed in both cases

Also available in: Atom PDF