Skip to content

Fix KeyError when deleting or renaming a coordinate system - #23

Open
BrennanTM wants to merge 1 commit into
PrecisionNeuroLab:mainfrom
BrennanTM:fix/coordsys-change-handler
Open

Fix KeyError when deleting or renaming a coordinate system#23
BrennanTM wants to merge 1 commit into
PrecisionNeuroLab:mainfrom
BrennanTM:fix/coordsys-change-handler

Conversation

@BrennanTM

Copy link
Copy Markdown

What brokeSession._onCoordinateSystemsChanged indexed self.coordinateSystems[key] unguarded, but the collection emits sigItemsChanged after removing the old key on delete/rename → KeyError on both.

Fixtry/except KeyError; a missing key counts as a persistable change and marks the session dirty (this handler is the only dirty-flagger for coordinateSystems). Autogeneration only calls setItem, so no spurious dirty flags there.

Teststests/test_Model/test_coordinateSystemsSessionHandling.py (2).

Related, not fixed hereAffineTransformedCoordinateSystem can't be serialized (masked because affine systems are autogenerated and swapped for placeholders before save); see #16.

Session._onCoordinateSystemsChanged looked up every signaled key without
guarding for deletions/renames, but the collection emits sigItemsChanged
after the old key is removed. Guard with try/except KeyError, treating a
missing key as a persistable change and flagging the session dirty. Note
this handler is the sole dirty-flagger for coordinateSystems (unlike the
similarly-guarded _onSamplesChanged, whose dirty flagging happens in a
separate unconditional connection), so a missing key breaks-to-dirty
rather than continuing.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant