libvlcpp | branch: master | Hugo Beauzée-Luyssen <[email protected]> | Thu Jul 30 11:14:07 2015 +0200| [bd6ff48af25e7d2670b16efd31b87d0d4c3c4f65] | committer: 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. > http://git.videolan.org/gitweb.cgi/libvlcpp.git/?a=commit;h=bd6ff48af25e7d2670b16efd31b87d0d4c3c4f65 --- cppcx/EventManagerCX.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cppcx/EventManagerCX.hpp b/cppcx/EventManagerCX.hpp index 6683e31..b53931e 100644 --- a/cppcx/EventManagerCX.hpp +++ b/cppcx/EventManagerCX.hpp @@ -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; }; _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
