I looked into this further and believe I’ve found the cause of the problem.
I prepared an update for the bug on mantis (http://tracker.ardour.org/view.php?id=5414#bugnotes) but have added it here as I don’t seem to have a login over there.
Apologies in advance if this update doesnt belong here.
I’m new here, and just trying to help where I can.
programming error: request for non-existant audio range (0) (http://tracker.ardour.org/view.php?id=5414#bugnotes)
The problem starts when a drag event is triggered with the users selection of the range to be duplicated.
‘clicked_selection’ is set to zero at line 3956 in editor_drag.cc as part of the SelectionDrag::finished(…) callback.
This occurs even if the user action is a time selection.
After this the logic subsequently breaks down in ‘TimeSelection::operator (uint32_t which)’, line 33, time_selection.cc as ‘which’ (set from clicked_selection) now contains zero, the original clicked_selection id having been over written and lost. Hence the ‘non-existent audio range (0)!’ crash seven lines after.
You can see this with a couple of added debug cout lines after the loop start, line 35 time_selection.cc.
std::cout << "which = " << which << std::endl;
std::cout << “URHERE i = " << i->id << " (” << i->start << “,” << i->end << “)” << std::endl;
You will see it iterating past the users time selection (identified by the start and end sample values) before finally crashing.
To fix this issue I tried moving where clicked_selection is zero’d (together with stop_canvas_autoscroll() for good measure) before the previous closing ‘}’ in editor_drag.cc.
— editor_drag.cc 2014-02-19 18:22:52.000000000 +0000
+++ editor_drag.cc.new 2014-04-04 09:36:20.649246999 +0100
@@ -3950,10 +3950,13 @@
s->request_stop (false, false);
- _editor->stop_canvas_autoscroll ();
- _editor->clicked_selection = 0;
This seems to resolve the issue, duplicate works fine, no crash.
I don’t not know yet what if any, other functionality this patch may break.
I’ll leave it in my build here and test it more as I use Ardour.