X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/557002cf8162a0073dbc7050732cb6d75e184148..5fab0c8d86f7bd7015db8d0ece8ce02ba1b602d8:/src/msw/mediactrl_wmp10.cpp?ds=sidebyside diff --git a/src/msw/mediactrl_wmp10.cpp b/src/msw/mediactrl_wmp10.cpp index e1f8e1d088..24145bbd88 100644 --- a/src/msw/mediactrl_wmp10.cpp +++ b/src/msw/mediactrl_wmp10.cpp @@ -50,20 +50,14 @@ #pragma hdrstop #endif -//--------------------------------------------------------------------------- -// MediaCtrl include -//--------------------------------------------------------------------------- +#if wxUSE_MEDIACTRL && wxUSE_ACTIVEX + #include "wx/mediactrl.h" -//--------------------------------------------------------------------------- -// Compilation guard -//--------------------------------------------------------------------------- -#if wxUSE_MEDIACTRL +#ifndef WX_PRECOMP + #include "wx/log.h" +#endif -//--------------------------------------------------------------------------- -// WX Includes -//--------------------------------------------------------------------------- -#include "wx/log.h" // wxLogDebug #include "wx/msw/private.h" // user info and wndproc setting/getting #include "wx/msw/ole/activex.h" // wxActiveXContainer - COM-specific stuff @@ -681,6 +675,7 @@ public: wxSize m_bestSize; // Actual movie size bool m_bWasStateChanged; // See the "introduction" + wxEvtHandler* m_evthandler; friend class wxWMP10MediaEvtHandler; DECLARE_DYNAMIC_CLASS(wxWMP10MediaBackend) @@ -705,7 +700,7 @@ public: private: wxWMP10MediaBackend *m_amb; - DECLARE_NO_COPY_CLASS(wxWMP10MediaEvtHandler) + wxDECLARE_NO_COPY_CLASS(wxWMP10MediaEvtHandler); }; #endif @@ -732,6 +727,7 @@ wxWMP10MediaBackend::wxWMP10MediaBackend() m_pWMPPlayer(NULL) { + m_evthandler = NULL; } //--------------------------------------------------------------------------- @@ -745,7 +741,11 @@ wxWMP10MediaBackend::~wxWMP10MediaBackend() m_pAX->DissociateHandle(); delete m_pAX; - m_ctrl->PopEventHandler(true); + if (m_evthandler) + { + m_ctrl->RemoveEventHandler(m_evthandler); + delete m_evthandler; + } #else AtlAxWinTerm(); _Module.Term(); @@ -818,7 +818,8 @@ bool wxWMP10MediaBackend::CreateControl(wxControl* ctrl, wxWindow* parent, m_pAX = new wxActiveXContainer(ctrl, IID_IWMPPlayer, m_pWMPPlayer); // Connect for events - m_ctrl->PushEventHandler(new wxWMP10MediaEvtHandler(this)); + m_evthandler = new wxWMP10MediaEvtHandler(this); + m_ctrl->PushEventHandler(m_evthandler); #else _Module.Init(NULL, ::GetModuleHandle(NULL)); AtlAxWinInit(); @@ -1515,7 +1516,4 @@ bool MyApp::OnInit() #endif // WMP mobile 9 hacks -//--------------------------------------------------------------------------- -// End wxMediaCtrl Compilation Guard and this file -//--------------------------------------------------------------------------- -#endif // wxUSE_MEDIACTRL +#endif // wxUSE_MEDIACTRL && wxUSE_ACTIVEX