Audacity Bug Summary
••• Introduction •••
••• Keywords •••
    Audacity 3.0.3 development began 19th April 2021

Audacity Bugzilla



Bug 1735 - Crash when pasting Note selection in Note track that starts after zero
Crash when pasting Note selection in Note track that starts after zero
Status: RESOLVED QUICKFIXED
Product: Audacity
Classification: Unclassified
Component: MIDI
2.2.0
Per OS macOS and Linux
: P1 Repeatable
Assigned To: Default Assignee for New Bugs
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2017-09-04 05:52 UTC by Steve Daulton
Modified: 2018-08-20 11:51 UTC (History)
5 users (show)

See Also:
Steps To Reproduce:
1) Import a MIDI file 2) Time shift the note track so that it starts after zero 3) Select and copy (Ctrl+C) a portion of the Note track 4) Click some time beyond the end of the Note track 5) Ctrl+V to paste Audacity crashes
Release Note:
First Git SHA:
Group: ---
Workaround:
Closed: 2018-08-20 00:00:00
petersampsonaudacity: Test‑OK‑Win+
petersampsonaudacity: Test‑OK‑Mac+
petersampsonaudacity: Test‑OK‑Lin+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Steve Daulton 2017-09-04 05:52:47 UTC
1) Import a MIDI file
2) Time shift the note track so that it starts after zero
3) Select and copy (Ctrl+C) a portion of the Note track
4) Click some time beyond the end of the Note track
5) Ctrl+V to paste
Audacity crashes

Terminal output:

audacity: ../../lib-src/portsmf/allegro.h:454: Alg_beat& Alg_beats::operator[](int): Assertion `i >= 0 && i < len' failed.
Aborted (core dumped)
Comment 1 Peter Sampson 2017-09-04 11:38:33 UTC
Testing with Beta 02Sep17

a) on Mac - macOS Sierra 10.12.6 - I also get the crash both if I try to past fter the shifter original or in the time space before it

b) on Windows the paste works fine and properly (afaict) and with no crash
Comment 3 Peter Sampson 2017-09-08 04:45:29 UTC
(In reply to Paul L from comment #2)
Tested in macOS Sierra 10.12.6 761bd6b 08Sep16

Fails on Mac

The original steps to reproduce work fine - pasting to the right of the time shifted MIDI Note track seesm to paste fine.

But when pasting to the time space prior to the time shifted MIDI Note track:
a) the length of the pasted notes approximately doubles (stretched) and can push the original Note track further over to the right
b) this pasted section obviously palys slow
c) some notes at the beginning are not actually part of the track, they are outside the gridded area of the Notes
d) a Cmd+A and Cmd+K deletes the proper gridded section of the note track but leaves the non-gridded notes
e) these non-gridded standed notes can be played
f) these non-gridded standed notes cannot be selected by any means and thus cannot be deleted (except by deleting the whole track)
Comment 4 Peter Sampson 2017-09-08 05:04:11 UTC
This is no no longer a crash-cause so probably can be reduced from P1.

But it's still a bit embarrassing for one of our new 2.2.0 headline Features.

But it's definitely not a regression - the same crash occurs in 2.1.3 and 2.1.2
Comment 5 Steve Daulton 2017-09-08 05:29:37 UTC
(In reply to Peter Sampson from comment #3)
Peter wrote:
> But when pasting to the time space prior to the time shifted MIDI Note track:

On Linux, the notes / tempo slows. 
The "bar lines" become very widely spaced, with erratic spacing.

Undo the paste works as expected, but if I then "redo" ("Ctrl + Shift + Z" or "Edit menu > Redo") Audacity crashes.

audacity: ../../../lib-src/portsmf/allegro.h:579: void Serial_read_buffer::check_input_buffer(long int): Assertion `get_posn() + needed <= len' failed.
Aborted (core dumped)
Comment 6 Peter Sampson 2017-09-08 11:32:03 UTC
(In reply to Steve Daulton from comment #5)
>Undo the paste works as expected, but if I then "redo" 
>("Ctrl + Shift + Z" or "Edit menu > Redo") Audacity crashes.

On Mac Undo and then Redo works fine (repeatedly) - no crash
Comment 7 Peter Sampson 2017-09-09 04:51:19 UTC
Tesrting the refix cee28ab 09Sep17 on macOS Sierra 10.12.6

This now appears to work correctly on Mac.

I tested

1) pasting to the right of the time shifted track - stiill works properly

2) pasting to the left of the time shifted track with sufficient space for the pasted audio
3) pasting to the left of the time shifted track with insufficient space for the pasted audio
In both cased 2&3 the notes get pasted in correctly with no stretcking, any intervening space betwwen that pasted and the origial notes is filed with the note grid.
All can be selected and deleted

4) also tested repeated undos and redos

Looks to be fixed ok on Mac - but in the light of Steve's crash on Linux thsi must be tested on Linux before closure (and should be tested on Windows too)
Comment 8 Peter Sampson 2017-09-10 03:06:55 UTC
Martyn tested this as ok on W10 - he wrote by email:

"I have tested this on Win 10.  On a previous build I see the bug, I updated and now I don't.  It looks ok, I tried the same tests as Peter at Comment #7 and no crashes."
Comment 9 Steve Daulton 2017-09-26 04:49:18 UTC
It is no longer crashing on Linux, but pasting does NOT appear to be doing the right thing. Exporting edited MIDI files is producing very strange ("wrong") results for me.

This bug, as worded, can probably be closed as QUICK FIX, though the 'residual' issues that I'm seeing still appear to be high priority.
Comment 10 Paul L 2017-09-26 12:11:35 UTC
(In reply to Steve Daulton from comment #9)

The case described in comment 9 is fixed at:  https://github.com/audacity/audacity/commit/4a0fbf83af2940d473dfab32aa913162cd71737d

This should be tested for region selections entirely left of the note track, and for regions beginning left but ending in the track.
Comment 11 Peter Sampson 2017-09-27 12:35:21 UTC
Testing on W10 audacity-win-4a0fbf8-2.2.0-beta-26Sep17
and on macOS Sierra 10.12.6 4a0fbf8 27Sep17

With a note track that starts after zero I can select from withn the note track, copy that selection and than paste it either after the existing Note track with no crashing.

Therefore I am going to mark this bug as resolved.

----------------------------------------------

However ther may well be reamining some odd Note trarack pasting behaviors - but they, whn identified, not form part of thsi P1 crash bug - and thus should be reported and tracked in separate Bugzilla thread(s).