• Hugo Beauzée-Luyssen's avatar
    EventManager: Fix potential use-after-free · 62abf003
    Hugo Beauzée-Luyssen authored
    When move-assigning, or copy-assigning, any object that holds an event
    manager & inherits from Internal will have the internal class
    copy/move constructed first, causing its internal shared pointer to
    be overriden, and in turn the libvlc object to be released.
    This is a problem if this object contains an event manager with
    registered events, as the event manager will be overriden afterward,
    causing its destructor to unregister the events after the libvlc
    object it needs to unregister the events has been released.
    
    This commit ensures we hold on to the object associated with the event
    manager, and that we explicitely unregister all events before releasing
    the object.
    62abf003