I know you're hard at work with Paddy2, which will probably get rid of this issue, but here it goes anyway…
We're seeing a lot of crashes in Sketch, related to the use of coscript.shouldKeepAround, and Paddy 1 is usually involved. We believe the cause of the crash to be something like this:
an action is dispatched and start a long running script using coscript.shouldKeepAround = true
a second action is dispatched before the first one has finished. Because there is already a cocoascript context created by the first action, we will reuse it since it's the same command.
the second action finishes before the first one (perhaps even synchronously), setting coscript.shouldKeepAround = false
we clean up the context since it is not supposed to be kept around
the first action finishes and crashes because there is no context since it is not leaking anymore
I know you're hard at work with Paddy2, which will probably get rid of this issue, but here it goes anyway…
We're seeing a lot of crashes in Sketch, related to the use of
coscript.shouldKeepAround
, and Paddy 1 is usually involved. We believe the cause of the crash to be something like this:coscript.shouldKeepAround = true
coscript.shouldKeepAround = false
We added
fibers
a while ago, precisely to fix this type of issue (you can check the docs for the feature on https://developer.sketchapp.com/reference/api/#async)Thanks in advance!