Skip to content

fix: keep Manage Timelines from selecting a deleted timeline - #680

Merged
FelipeDefensor merged 1 commit into
devfrom
fix/manage-timelines-rebuild
Oct 7, 2026
Merged

FelipeDefensor merged 1 commit into
devfrom
fix/manage-timelines-rebuild

Conversation

@FelipeDefensor

@FelipeDefensor FelipeDefensor commented Oct 6, 2026 •

Copy link
Copy Markdown
Collaborator

With Manage Timelines open after moving a timeline up or down, File > New or deleting another timeline could close TiLiA through the crash dialog. Whether it did depended on where the moved timeline ended up.

Every timeline deletion rebuilds the window's list. TimelinesListWidget.update_items() cleared it with its signals live, and while the old items went, the current item could land on the one whose timeline had just been deleted. ManageTimelines.on_list_current_item_changed() then got None from Get.TIMELINE and raised AttributeError in a Qt slot, which the app's exception hook turns into the crash dialog.

The list now rebuilds with its signals blocked. Its callers already set the current row afterwards, which updates the window's checkbox and buttons as before.

Regression tests: tests/ui/windows/test_manage_timelines.py::TesttimelinesChangeWhileOpen::test_timeline_is_deleted_after_reordering and ::test_new_file_after_reordering. Both fail on dev with the AttributeError. They collect what reaches sys.excepthook, since exceptions raised in Qt slots never reach pytest.

Repro bundle

The fixture is a Slider timeline followed by two marker timelines, First and Second, with no media and a length of 100 s. It is already built, untracked, in this branch's worktree, with the CLI:

mkdir -p repro && printf '%s\n' \
  'metadata set-media-length 100' \
  'timelines add marker --name "First"' \
  'timelines add marker --name "Second"' \
  "save \"$PWD/repro/manage_timelines.tla\" --overwrite" \
  | uv run --python 3.12 tilia --user-interface cli

See the bug, on dev at dac53f4c, this branch's base:

uv run --directory /home/felipe.dm/dev/worktrees/base-manage-timelines-rebuild --python 3.12 tilia "/home/felipe.dm/dev/worktrees/fix-manage-timelines-rebuild/repro/manage_timelines.tla"

See the fix:

uv run --directory /home/felipe.dm/dev/worktrees/fix-manage-timelines-rebuild --python 3.12 tilia "/home/felipe.dm/dev/worktrees/fix-manage-timelines-rebuild/repro/manage_timelines.tla"
  • Action: choose Timelines > Manage, select First and press ▲, so that First moves above Slider. Leave the window open, choose File > New, and don't save.
  • Bug: the crash dialog appears and TiLiA closes.
  • Correct: a new file opens, and TiLiA keeps running.

Checked before opening: a throwaway test that opens this fixture and replays the action with real mouse clicks gets the AttributeError on dev and nothing on this branch.

Not verified by the bundle: deleting another timeline instead of File > New, which the first regression test covers.

Release-checklist rows: N15. The IDs refer to the checklist copy in tilia-testing (release-checklist/test-links.csv); the code doesn't mention them.

With Manage Timelines open after moving a timeline up or down, File > New
or deleting another timeline closed TiLiA through the crash dialog. Each
deletion rebuilds the window's list, and clearing the old items could make
the current item one whose timeline was just deleted. The window then asked
for that timeline, got None, and raised AttributeError in a Qt slot.

The list now rebuilds with its signals blocked; its callers set the current
row afterwards, which updates the window as before.
@FelipeDefensor
FelipeDefensor merged commit c8a1ee6 into dev Oct 7, 2026
11 checks passed
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