Commit bd6ff48a authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

cppcx: Fix a crash when releasing the EventManager

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.
parent 6ec7a0d9
......@@ -524,7 +524,7 @@ namespace libVLCX
MediaPlayerEventManager(VLC::MediaPlayerEventManager& em);
private:
VLC::MediaPlayerEventManager m_em;
VLC::MediaPlayerEventManager& m_em;
std::vector<VLC::EventManager::RegisteredEvent> m_events;
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment