I could see if it’s possible to circumvent by wrapping the removal of sequences inside an idle_observable notifier. Is it really a practical problem, though? If the bug only occur during deliberate provocation, I’d prefer to leave it the way it is.
I’m sorry to tell you this…I have been doing tests with another own tool that also adds patterns automatically. By doing various tests, I have noticed that there is also a problem with the native Undo (CTRL + Z). If I hold down (CTRL + Z) and many times Renoise returns an error and closes (A fatal error or chrash occurred …), the same error…
So, I went back to your tool, and the same thing happens. I would not recommend the use of this tool because Renoise does not seem stable. Apparently, Renoise misses out by deleting a pattern at a certain time. I suppose that, when a pattern is added, an index or something is recorded and something is wrong, because when it comes to erase, there comes a moment when something goes wrong, as if it wanted to erase something that does not exist, or it does it too fast or too slow. I don’t know!
That to force with the wheel of the mouse then Renoise crash is already something to take into account. But that Undo width CTRL + Z does it is a very serious matter. This should be thoroughly reviewed by the Renoise Team.
I have done another test. I have put 5ms in the USB keyboard repeat settings, and I press the down key to add patterns automatically with your tool. Here it seems to work correctly!
Everything seems to indicate that using the mouse wheel in the sequence is conflicting, and does not depend on the tool at all (the code), it is something internal to Renoise. Maybe we should report this as a serious BUG. Imagine this issue in a RAS type tool. The truth is that these errors annoy a lot!!!
As I understand it, no tool should be able to hang Renoise. That is the objective!But unfortunately it is not!We do not have the control to avoid these errors and it is frustrating, because there is no support for many months!
Have you tried to make a tool type RAS, without this error is present?This kind of errors make developing a tool an absurdity. You can think and write the code well and then Renoise hangs anyway.
Edit :In case it helps:I think the problem is when the patterns are added, that the index register is not correctly established (I suppose). The problem is not in the process undo CTRL + Z or in the act of deleting, but in that which must be deleted (which has been registered for a long time before).