Fix bug: a callback could be prematurely GCed.

Now a reference to the callback is saved in the [context] type
when it is set.