Skip to content

Commit 6b02cb5

Browse files
shrimblyclaude
andcommitted
guard shimmer advance against a queued post-stop tick
An interval tick already queued when the timer stops can invoke the callback once more on a stalled event loop, re-showing the final frame. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 80517a1 commit 6b02cb5

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

‎sharp_frames/ui/screens/configuration.py‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,12 +152,17 @@ def _start_shimmer(self) -> None:
152152
)
153153

154154
def _advance_frame(self) -> None:
155-
"""Show the next frame and stop the interval after the last one."""
155+
"""Show the next frame and stop the interval after the last one.
156+
157+
A tick that was already queued when the timer stopped may still
158+
invoke this callback once more, so it no-ops after the last frame.
159+
"""
160+
if self._next_frame_index > len(self.frames) - 1:
161+
return
156162
self._show_frame(self._next_frame_index)
157163
if self._next_frame_index >= len(self.frames) - 1:
158164
self._shimmer_timer.stop()
159-
else:
160-
self._next_frame_index += 1
165+
self._next_frame_index += 1
161166

162167
def _show_frame(self, frame_index: int) -> None:
163168
"""Swap colour spans without recalculating the stable title layout."""

0 commit comments

Comments
 (0)