Bug report #7540
Merge tool bug when a shapefile is loaded multiple times
|Affected QGIS version:||master||Regression?:||No|
|Operating System:||Easy fix?:||No|
|Pull Request or Patch supplied:||No||Resolution:||fixed/implemented|
|Crashes QGIS or corrupts data:||Yes||Copied to github as #:||16483|
When a Shapefile is loaded multiple times (either in the same project via "duplicate layer" or in two different QGis instances), there is a critical bug upon merging features.
Both merged parts simply disappear without any error (though it seems sometimes QGis crashes).To reproduce:
- create a new shapefile (line or polygon)
- enter edit mode
- draw a feature and split it several times with the scissor tool
- exit edit mode
- duplicate the layer
- enter edit mode on one of the two layers
- select two line segments and merge them with the merge tool
- exit edit mode
- reload the project and see!!
Repack shapefiles when saving after deleting features
- QgsVectorDataProvider::dataChanged() will be emitted
- QgsVectorLayer::dataChanged() will be emitted
- Clears QgsVectorLayerCache
- Reloads the attribute table
- Clears the selection
Looking forward to people complaining about their lost selection...
#5 Updated by Olivier Dalang about 7 years ago
- on the layer that was not edited, you see that the two merged parts have disappeared
- on the layer that was edited, you see the two merged parts plus the result of the merge
But actually, I'm just discovering that the shapefile seems in a deeper mess, even after reloading : if you create a new polygon, no matter what shape, it will take the shape of the result of the merge.
Here's a screencast of the procedure :
#12 Updated by Olivier Dalang about 7 years ago
The behavior changed a little bit but I still get data corruption (with master from yesterday, under Windows 7).
It's no more necessary to reload the project to see the data loss.
Here's a screencast : https://www.dropbox.com/s/g70fkaus6j40vll/mergeBug4.avi
#16 Updated by Jürgen Fischer about 7 years ago
Jürgen Fischer wrote:
Fixed in changeset 78b04df91a1b85ee70ff5b326980f480b3069d47.
It was caused by locking. QGIS does a REPACK after deleting and that silently fails with current OGR. GDAL pull request #17 should fix this by adding an error message. reopening the original DBF if it can't be removed and cleaning up the
Nevertheless QGIS now checks if there still is a
*_packed.dbf to detect that the REPACK failed and reopens the dataset in that case.
#19 Updated by Giovanni Manghi over 5 years ago
it is pretty easy to replicate this issue, it is just needed to "insist" a bit. Here two screencast, that as some point show that after removing a shape and re-adding it features are lost!
The second show also a possible bug in the "split features" tool.
#23 Updated by Giovanni Manghi over 5 years ago
- Status changed from Feedback to Closed
- Resolution set to fixed/implemented