FIXED: Timer Crashes TD when callbacks delete OP

TD[2023.11510]-WIN10[22H2-19045.4046]

Hello Everybody,

Okay, so im building a callback within a timer, that destroys the timer after its done.

Well, TD crashes after the callback gets activated.
Is the way ive built it wrong?
->I’ve also tried to op(‘timer7’).destroy()
_>> Same Crash

Best wishes

  1. Use the timerOp argument which passes you already the correct operatr object.
timerOp.destroy()
  1. You can use a delayed function call. The callback is still called as part of the timer, so removing the time while the function still is running certainly can result in a crash.
run( lambda: timerOp.destroy(), delayFrames = 1)
  1. Maybe try to recycle your timerCHOPs instead of creating and them on the go.
1 Like

Thank you very much for the fast reply and the ideas.

“timerOp.destroy()”
and
“run( lambda: timerOp.destroy(), delayFrames = 1)”

->still crashes my TD in the onDone(args):

Ive created a empty project.

-Created a timerCHOP.

Tested both ideas in the onDone(args).

TD just closes itself when the “DONE” is set to 1.

Hi @Aikon

Thanks for the report.

This should be caught and result in an error.

That being said, as @alphamoonbase mentioned, you might want to rework things a bit so that you don’t have to destroy timers this way and reuse one, or multiple.

They are many examples of use cases for the Timer CHOP in the Op Snippets.

Best,
Michel

1 Like

Thank you very much for your reply, =)

the thing is, i need the multiple timer.
They are saving a state and need to be gone after that part is finished.

->Like a book im reading for example.
If i read one page to 25% and go to the next page.

The next page creates a new Timer that will also stop if i go fwd to the next page.(f.e.50%)

And if i return, the 25% timer will continue its work until its getting destroyed.

Ive seen tables “sequences” and the other great examples. Yet i thought that “this” could give me a better way to handle things.

Best wishes

if Anyone is wondering how to solve this problem.

Im creating a textDAT with the n.destroy() command to be run in a Delay, as alphamoonbase said above.

So:

Timer finishes.
Sets Done.
Callbacks wait the 10 Frames and runs the n.destroy()

Best wishes

This will be fixed in build 2023.11579+

Advise against this workflow still remains though. :wink:

Best,
Michel