Cleanups of data_ptr setting and getting
Unset the event callback if it is None