23 if (_weak_ref !=
nullptr && !_weak_ref->was_deleted()) {
24 _weak_ref->add_callback(callback, _void_ptr);
25 }
else if (_void_ptr !=
nullptr) {
26 callback->wp_callback(_void_ptr);
36 if (_weak_ref !=
nullptr) {
37 _weak_ref->remove_callback(callback);
51 return _void_ptr !=
nullptr && (_weak_ref ==
nullptr || _weak_ref->was_deleted());
60 return _weak_ref !=
nullptr && !_weak_ref->was_deleted();
Derive from this class and override the callback() method if you want to get an immediate callback fr...
void add_callback(WeakPointerCallback *callback) const
Sets a callback that will be made when the pointer is deleted.
void remove_callback(WeakPointerCallback *callback) const
Removes a previously added callback.
bool was_deleted() const
Returns true if the object we are pointing to has been deleted, false otherwise.
bool is_valid_pointer() const
Returns true if the pointer is not null and the object has not been deleted.