use safer RemoveEventHandler() instead of PopEventHandler() (patch 1678016)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@44842 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
9092371c0a
commit
0fa5ce0c76
@ -1483,6 +1483,7 @@ public:
|
||||
LPAMGETERRORTEXT m_lpAMGetErrorText;
|
||||
wxString GetErrorString(HRESULT hrdsv);
|
||||
#endif // __WXDEBUG__
|
||||
wxEvtHandler* m_evthandler;
|
||||
|
||||
friend class wxAMMediaEvtHandler;
|
||||
DECLARE_DYNAMIC_CLASS(wxAMMediaBackend)
|
||||
@ -1573,6 +1574,7 @@ wxAMMediaBackend::wxAMMediaBackend()
|
||||
#endif
|
||||
m_bestSize(wxDefaultSize)
|
||||
{
|
||||
m_evthandler = NULL;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
@ -1591,7 +1593,11 @@ wxAMMediaBackend::~wxAMMediaBackend()
|
||||
if (GetMP())
|
||||
GetMP()->Release();
|
||||
|
||||
m_ctrl->PopEventHandler(true);
|
||||
if (m_evthandler)
|
||||
{
|
||||
m_ctrl->RemoveEventHandler(m_evthandler);
|
||||
delete m_evthandler;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1683,7 +1689,8 @@ bool wxAMMediaBackend::CreateControl(wxControl* ctrl, wxWindow* parent,
|
||||
#endif
|
||||
);
|
||||
// Connect for events
|
||||
m_ctrl->PushEventHandler(new wxAMMediaEvtHandler(this));
|
||||
m_evthandler = new wxAMMediaEvtHandler(this);
|
||||
m_ctrl->PushEventHandler(m_evthandler);
|
||||
|
||||
//
|
||||
// Here we set up wx-specific stuff for the default
|
||||
|
@ -429,6 +429,7 @@ public:
|
||||
wxTimer* m_timer; // Load or Play timer
|
||||
wxQuickTimeLibrary m_lib; // DLL to load functions from
|
||||
ComponentInstance m_pMC; // Movie Controller
|
||||
wxEvtHandler* m_evthandler;
|
||||
|
||||
friend class wxQTMediaEvtHandler;
|
||||
|
||||
@ -605,6 +606,7 @@ LRESULT CALLBACK wxQTMediaBackend::QTWndProc(HWND hWnd, UINT nMsg,
|
||||
wxQTMediaBackend::wxQTMediaBackend()
|
||||
: m_movie(NULL), m_bPlaying(false), m_timer(NULL), m_pMC(NULL)
|
||||
{
|
||||
m_evthandler = NULL;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
@ -630,7 +632,11 @@ wxQTMediaBackend::~wxQTMediaBackend()
|
||||
}
|
||||
|
||||
// destroy wxQTMediaEvtHandler we pushed on it
|
||||
m_ctrl->PopEventHandler(true);
|
||||
if (m_evthandler)
|
||||
{
|
||||
m_ctrl->RemoveEventHandler(m_evthandler);
|
||||
delete m_evthandler;
|
||||
}
|
||||
|
||||
m_lib.DestroyPortAssociation(
|
||||
(CGrafPtr)m_lib.GetNativeWindowPort(m_ctrl->GetHWND()));
|
||||
@ -689,7 +695,8 @@ bool wxQTMediaBackend::CreateControl(wxControl* ctrl, wxWindow* parent,
|
||||
|
||||
// Part of a suggestion from Greg Hazel
|
||||
// to repaint movie when idle
|
||||
m_ctrl->PushEventHandler(new wxQTMediaEvtHandler(this, m_ctrl->GetHWND()));
|
||||
m_evthandler = new wxQTMediaEvtHandler(this, m_ctrl->GetHWND());
|
||||
m_ctrl->PushEventHandler(m_evthandler);
|
||||
|
||||
// done
|
||||
return true;
|
||||
|
@ -675,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)
|
||||
@ -726,6 +727,7 @@ wxWMP10MediaBackend::wxWMP10MediaBackend()
|
||||
m_pWMPPlayer(NULL)
|
||||
|
||||
{
|
||||
m_evthandler = NULL;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
@ -739,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();
|
||||
@ -812,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();
|
||||
|
Loading…
Reference in New Issue
Block a user