You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
0 commit comments