Sets a flag on the closure to indicate that its calling environment has become invalid, and thus causes any future invocations of invoke on this this 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 invalidate, make sure that you've previously called @ref.
Note that invalidate will also be called when the reference count of a closure drops to zero (unless it has already been invalidated before).
Closure to invalidate