Closure.invalidate

Sets a flag on the closure to indicate that its calling environment has become invalid, and thus causes any future invocations of Closure.invoke on this closure to be ignored. Also, invalidation notifiers installed on the closure will be called at this point. Note that unless you are holding a reference to the closure yourself, the invalidation notifiers may unref the closure and cause it to be destroyed, so if you need to access the closure after calling Closure.invalidate, make sure that you've previously called Closure.ref.

Note that Closure.invalidate will also be called when the reference count of a closure drops to zero (unless it has already been invalidated before).

class Closure
void
invalidate
()