Doxygen with github
|
Implements an event handle that automatically unbinds callbacks on destruction. More...
#include <ksEventHandle.h>
Public Member Functions | |
ksEventHandle (std::weak_ptr< ksEventInterface > &&eventBaseWp, std::size_t callbackUID) | |
Constructs event handle. | |
virtual | ~ksEventHandle () |
Destructs event handle. Unbinds assigned callback from the list. | |
Protected Attributes | |
std::weak_ptr< ksEventInterface > | eventBaseWp |
Weak pointer to event object. | |
std::size_t | callbackUID {0} |
Unique callback ID. | |
Implements an event handle that automatically unbinds callbacks on destruction.
This prevents program crashes caused by forgetting to manually unbind callbacks. When the parent object is destroyed, the event handle ensures the callback is automatically unbound.
ksf::evt::ksEventHandle::ksEventHandle | ( | std::weak_ptr< ksEventInterface > && | eventBaseWp, |
std::size_t | callbackUID ) |
Constructs event handle.
eventBaseWp | R-value reference to weak pointer to event object. |
callbackUID | Unique callback ID. |