Skip to content
  • Hugo Beauzée-Luyssen's avatar
    cppcx: Fix a crash when releasing the EventManager · bd6ff48a
    Hugo Beauzée-Luyssen authored
    We don't want to hold a copy of the event manager, but rather a reference. The C++/CX type is intented to be solely a wrapper to the actual type.
    Furthermore, if due to C++/CX being garbage collected, holding a copy means the EventManagerCX destructor might be called after MediaPlayerCX's destructor, since it only decreases the EventManagerCX's refcount.
    Calling EventManagerCX's destructor without a valid libvlc_media_player_t (ie. VLC::MediaPlayer being deleted) will cause undefined behavior. By storing a reference, we ensure we just forward the events registrations to the actual VLC::EventManager, and that the GC won't bite us when releasing resources.
    bd6ff48a