Skip to content

[Bug]: A locked label can attach to a new feature that reuses a deleted feature's id #1135

Closed

Description

@jgregoriorincon

Before you start

  • I searched the existing issues and did not find a duplicate.
  • This is a bug report, not a usage question (questions belong in Discussions).

What happened?

With labels locked, a feature added after deleting the feature with the highest id shows its label, although it wasn't placed when the lock was taken.

Dataset::push gives a new feature max(id) + 1 (crates/data/src/lib.rs:340). Since #1134 a lock names each label by its feature's id, so the new feature takes the deleted one's id, matches its lock entry and is drawn there without a collision check. This isn't a regression: with row keys the new feature took the same row, so it had the same key. #1134 fixes the cases where rows move and leaves this one. Found in review of #1134.

Related: LabelKey keeps the feature id as usize, so on wasm32 (the web app) two ids that differ by a multiple of 2^32 share a key. That truncation already applied to streamed layers before #1134.

Steps to reproduce

  1. Load this CSV as XY points and label them by name. Gamma sits apart, so both labels show:
    name,x,y
    Alpha,0,0
    Gamma,10,10
  2. In the Labeling tab, turn on Lock.
  3. Delete Gamma (the highest id).
  4. Add a new point anywhere with the edit tools and give it a name.
  5. The new point's label shows, at the lock's place for Gamma, although it wasn't placed when the lock was taken.

Expected behavior

While labels are locked, a feature added after locking has no label, as any other new feature does; unlocking and locking again places it.

Ways to get there:

  • A monotonic next id in Dataset, so a deleted feature's id is never handed out again. This touches serialization and every reader that numbers features.
  • Or prune the lock entries of removed ids on each path that removes features (delete, cut, merge, geoprocessing updates, reloads). Undo restores the lock with the project, so it stays correct.

For the wasm32 truncation, widen the id in LabelKey to u64.

How are you running RustGIS?

  • Desktop app (downloaded release)
  • Desktop app (built from source)
  • Web app (https://web.rustgis.app)
  • Command line (rustgis-cli)

Version

0d5a23a (#1134)

Operating system, browser and graphics

Any (found by reading the code in review)

Activity

  1. added
    unconfirmed possible issue
    on Oct 29, 2026
  2. self-assigned this
    on Nov 2, 2026
  3. Mavrick-F commented on Nov 2, 2026

    @Mavrick-F
    Member

    The deletion/reuse case is fixed by #1271. I am taking the remaining wasm32 truncation: a probe using the current LabelKey type and renderer conversion confirms that feature IDs 1 and 4294967297 become the same key on wasm32. I will keep the full u64 feature ID through label placement, extrusion lookup and lock pruning, without changing Dataset ID allocation or the saved project format.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

unconfirmed possible issue

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions