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:
@@ -1483,6 +1483,7 @@ public:
|
|||||||
LPAMGETERRORTEXT m_lpAMGetErrorText;
|
LPAMGETERRORTEXT m_lpAMGetErrorText;
|
||||||
wxString GetErrorString(HRESULT hrdsv);
|
wxString GetErrorString(HRESULT hrdsv);
|
||||||
#endif // __WXDEBUG__
|
#endif // __WXDEBUG__
|
||||||
|
wxEvtHandler* m_evthandler;
|
||||||
|
|
||||||
friend class wxAMMediaEvtHandler;
|
friend class wxAMMediaEvtHandler;
|
||||||
DECLARE_DYNAMIC_CLASS(wxAMMediaBackend)
|
DECLARE_DYNAMIC_CLASS(wxAMMediaBackend)
|
||||||
@@ -1573,6 +1574,7 @@ wxAMMediaBackend::wxAMMediaBackend()
|
|||||||
#endif
|
#endif
|
||||||
m_bestSize(wxDefaultSize)
|
m_bestSize(wxDefaultSize)
|
||||||
{
|
{
|
||||||
|
m_evthandler = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
@@ -1591,7 +1593,11 @@ wxAMMediaBackend::~wxAMMediaBackend()
|
|||||||
if (GetMP())
|
if (GetMP())
|
||||||
GetMP()->Release();
|
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
|
#endif
|
||||||
);
|
);
|
||||||
// Connect for events
|
// 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
|
// Here we set up wx-specific stuff for the default
|
||||||
|
@@ -429,6 +429,7 @@ public:
|
|||||||
wxTimer* m_timer; // Load or Play timer
|
wxTimer* m_timer; // Load or Play timer
|
||||||
wxQuickTimeLibrary m_lib; // DLL to load functions from
|
wxQuickTimeLibrary m_lib; // DLL to load functions from
|
||||||
ComponentInstance m_pMC; // Movie Controller
|
ComponentInstance m_pMC; // Movie Controller
|
||||||
|
wxEvtHandler* m_evthandler;
|
||||||
|
|
||||||
friend class wxQTMediaEvtHandler;
|
friend class wxQTMediaEvtHandler;
|
||||||
|
|
||||||
@@ -605,6 +606,7 @@ LRESULT CALLBACK wxQTMediaBackend::QTWndProc(HWND hWnd, UINT nMsg,
|
|||||||
wxQTMediaBackend::wxQTMediaBackend()
|
wxQTMediaBackend::wxQTMediaBackend()
|
||||||
: m_movie(NULL), m_bPlaying(false), m_timer(NULL), m_pMC(NULL)
|
: 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
|
// destroy wxQTMediaEvtHandler we pushed on it
|
||||||
m_ctrl->PopEventHandler(true);
|
if (m_evthandler)
|
||||||
|
{
|
||||||
|
m_ctrl->RemoveEventHandler(m_evthandler);
|
||||||
|
delete m_evthandler;
|
||||||
|
}
|
||||||
|
|
||||||
m_lib.DestroyPortAssociation(
|
m_lib.DestroyPortAssociation(
|
||||||
(CGrafPtr)m_lib.GetNativeWindowPort(m_ctrl->GetHWND()));
|
(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
|
// Part of a suggestion from Greg Hazel
|
||||||
// to repaint movie when idle
|
// 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
|
// done
|
||||||
return true;
|
return true;
|
||||||
|
@@ -675,6 +675,7 @@ public:
|
|||||||
wxSize m_bestSize; // Actual movie size
|
wxSize m_bestSize; // Actual movie size
|
||||||
|
|
||||||
bool m_bWasStateChanged; // See the "introduction"
|
bool m_bWasStateChanged; // See the "introduction"
|
||||||
|
wxEvtHandler* m_evthandler;
|
||||||
|
|
||||||
friend class wxWMP10MediaEvtHandler;
|
friend class wxWMP10MediaEvtHandler;
|
||||||
DECLARE_DYNAMIC_CLASS(wxWMP10MediaBackend)
|
DECLARE_DYNAMIC_CLASS(wxWMP10MediaBackend)
|
||||||
@@ -726,6 +727,7 @@ wxWMP10MediaBackend::wxWMP10MediaBackend()
|
|||||||
m_pWMPPlayer(NULL)
|
m_pWMPPlayer(NULL)
|
||||||
|
|
||||||
{
|
{
|
||||||
|
m_evthandler = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
@@ -739,7 +741,11 @@ wxWMP10MediaBackend::~wxWMP10MediaBackend()
|
|||||||
m_pAX->DissociateHandle();
|
m_pAX->DissociateHandle();
|
||||||
delete m_pAX;
|
delete m_pAX;
|
||||||
|
|
||||||
m_ctrl->PopEventHandler(true);
|
if (m_evthandler)
|
||||||
|
{
|
||||||
|
m_ctrl->RemoveEventHandler(m_evthandler);
|
||||||
|
delete m_evthandler;
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
AtlAxWinTerm();
|
AtlAxWinTerm();
|
||||||
_Module.Term();
|
_Module.Term();
|
||||||
@@ -812,7 +818,8 @@ bool wxWMP10MediaBackend::CreateControl(wxControl* ctrl, wxWindow* parent,
|
|||||||
m_pAX = new wxActiveXContainer(ctrl, IID_IWMPPlayer, m_pWMPPlayer);
|
m_pAX = new wxActiveXContainer(ctrl, IID_IWMPPlayer, m_pWMPPlayer);
|
||||||
|
|
||||||
// Connect for events
|
// Connect for events
|
||||||
m_ctrl->PushEventHandler(new wxWMP10MediaEvtHandler(this));
|
m_evthandler = new wxWMP10MediaEvtHandler(this);
|
||||||
|
m_ctrl->PushEventHandler(m_evthandler);
|
||||||
#else
|
#else
|
||||||
_Module.Init(NULL, ::GetModuleHandle(NULL));
|
_Module.Init(NULL, ::GetModuleHandle(NULL));
|
||||||
AtlAxWinInit();
|
AtlAxWinInit();
|
||||||
|
Reference in New Issue
Block a user