A simple wrapper for a weak reference to a Object, suitable for use in asynchronous calls which should only affect the object if it hasn't already been freed.
As well as wrapping a weak reference to an object, this structure can contain an extra pointer to arbitrary data. This is useful for asynchronous calls which act on an object and some second piece of data, which are quite common in practice.
If more than one piece of auxiliary data is required, the user_data
argument to the constructor can be a struct or a
ValueArray.