#12220·audacity

Undo after stopping a recording on an unfocused track deletes the track and skips an undo step

Author: KrocosrCreated Sep 18, 2026Updated Sep 18, 2026
Labelsbug

Bug description

After stopping a recording while the track is unfocused (or after unfocusing and refocusing the track), pressing Undo deletes the entire track instead of undoing the recorded take. Pressing Undo again restores the track, but the undo history has skipped a step -> effectively 3 -> track deleted -> 1 instead of 3 -> 2 -> 1.

Steps to reproduce

  1. Start recording on a track.
  2. While recording, unfocus the track/press anywhere else on the track or other track (or unfocus and then refocus it).
  3. Stop the recording while the track is unfocused.
  4. Press Undo (Ctrl+Z or Edit > Undo).
  5. Observe that the whole track is deleted instead of undoing the recording.
  6. Press Undo again.
  7. Observe the track is restored, but a previous undo step has been skipped.

Expected behavior

After stopping a recording, Undo removes the recorded audio (3 -> 2). It should never delete the track itself, and no undo step should be skipped.

Actual behavior

Undo deletes the track outright. A second Undo restores the track but skips the previous history step, landing on 1 instead of 2.

Audacity Version

Audacity 4.0.0

Operating system

Windows

Additional context

Reproduced with the track losing/regaining focus between starting the recording and stopping it. This may be a focus-handling issue in how the undo stack is built during recording.