Bug report #21596

Editing a memory layer is corrupted when recreating a memory layer with same name

Added by Vincent Dionne over 3 years ago. Updated over 3 years ago.

Affected QGIS version:3.7(master) Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:29412



this his how to replicate:

1- create a memory layer ( linestring ) and name it "test"
2- add a new feature ( for example, a short 3 point linestring)
3- SAVE the layer ( mandatory)
5- Remove the layer
6- create a new memory layer ( linestring) with the same name "test"
7- Add a new feature somewhere else ( another 3 point linestring)
8- Click on the node tool and voila! If you try to edit the linestring ... nothing happens. But if you put your mouse over the location where the first linestring was... it will by highlight (red digitizing line)

That's it. It is a problem because i have a plugin that create and recreate a memory layer with the same name.

I hope this is clear enough.

thank you!


#1 Updated by Vincent Dionne over 3 years ago

BTW, the name of the second memory layer can be different... and you will get the same result.

#2 Updated by Giovanni Manghi over 3 years ago

  • Status changed from Open to Feedback

Cannot replicate here. Have you tried with a new/clean profile (no 3rd party plugins)?

#3 Updated by Alessandro Pasotti over 3 years ago

  • Affected QGIS version changed from 3.6.0 to 3.7(master)
  • Assignee set to Alessandro Pasotti

I've been able to reproduce a similar bug on a different workflow.
I'm still struggling to reproduce it in a test but I'm working on it.

#4 Updated by Alessandro Pasotti over 3 years ago

  • Assignee deleted (Alessandro Pasotti)

No, sorry: it was a different problem and I could not reproduce the issue described in this ticket.

The only way to reproduce a similar issue is if you delete the features directly from the provder without passing through the QgsVectorLayer edit buffer, which is not recommended btw.

If you remove the layer from the legend it gets deleted and if it gets deleted the snapping locator cache is cleared (well, not really cleared but it won't get used for another layer even if it has the same name).

Also available in: Atom PDF