Closed dexterurbane closed 7 years ago
Solution perhaps something along the lines of:
Need to distinguish between actions that are owned by the event, and those that are externally owned.
On last point: Action uses PIMPL, with shared_ptr to ActionImpl. In action destructor, if the use count is two, then we need to remove the action from its event.
Fixed.
Ideally, actions should behave as if they are an observer that is totally separate from the event they observe. In particular, when the subject of an action goes out of scope / is destructed, the action should no longer exist.
The current architecture, however, stores the actions inside the event. This is sometimes appropriate - for example, the action could be an arbitrary std::function, such as a logging function.
Think about how we can reconcile these two facts.