Applied popup patch for deleting the handlers
correctly. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@31649 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -198,16 +198,13 @@ wxPopupTransientWindow::wxPopupTransientWindow(wxWindow *parent, int style)
|
|||||||
wxPopupTransientWindow::~wxPopupTransientWindow()
|
wxPopupTransientWindow::~wxPopupTransientWindow()
|
||||||
{
|
{
|
||||||
PopHandlers();
|
PopHandlers();
|
||||||
|
|
||||||
delete m_handlerFocus;
|
|
||||||
delete m_handlerPopup;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxPopupTransientWindow::PopHandlers()
|
void wxPopupTransientWindow::PopHandlers()
|
||||||
{
|
{
|
||||||
if ( m_child )
|
if ( m_child )
|
||||||
{
|
{
|
||||||
if ( !m_child->RemoveEventHandler(m_handlerPopup) )
|
if ( m_handlerPopup && !m_child->RemoveEventHandler(m_handlerPopup) )
|
||||||
{
|
{
|
||||||
// something is very wrong and someone else probably deleted our
|
// something is very wrong and someone else probably deleted our
|
||||||
// handler - so don't risk deleting it second time
|
// handler - so don't risk deleting it second time
|
||||||
@@ -221,19 +218,26 @@ void wxPopupTransientWindow::PopHandlers()
|
|||||||
#ifdef __WXMSW__
|
#ifdef __WXMSW__
|
||||||
if ( m_focus )
|
if ( m_focus )
|
||||||
{
|
{
|
||||||
if ( !m_focus->RemoveEventHandler(m_handlerFocus) )
|
if ( m_handlerFocus && !m_focus->RemoveEventHandler(m_handlerFocus) )
|
||||||
{
|
{
|
||||||
// see above
|
// see above
|
||||||
m_handlerFocus = NULL;
|
m_handlerFocus = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if ( !RemoveEventHandler(m_handlerFocus) )
|
if ( m_handlerFocus && !RemoveEventHandler(m_handlerFocus) )
|
||||||
{
|
{
|
||||||
// see above
|
// see above
|
||||||
m_handlerFocus = NULL;
|
m_handlerFocus = NULL;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// delete the handlers, they'll be created as necessary in Popup()
|
||||||
|
delete m_handlerPopup;
|
||||||
|
m_handlerPopup = NULL;
|
||||||
|
delete m_handlerFocus;
|
||||||
|
m_handlerFocus = NULL;
|
||||||
|
|
||||||
m_focus = NULL;
|
m_focus = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user