Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
STYLE: Declare
Observer::m_Event
(from itk::Object
) as unique_ptr
The original code technically allowed an `Observer` (from the implementation of `itk::Object`) to be copied, causing its destructor to possibly be called twice, trying to do `delete m_Event` twice on the very same event object. Which would have undefined behavior, possibly causing a crash. This commit solves this potential problem by declaring m_Event as a `unique_ptr`, and removing the user-defined `Observer` destructor (leaving it "implicitly defaulted", following the Rule of Zero). Thereby it also removes the `virtual` keyword from the destructor, which is OK, because `Observer` is not a base class.
- Loading branch information