replaced DeleteEvtHandler with a call to RemoveEventHandler
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@13806 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -392,34 +392,14 @@ void wxScrollHelper::DeleteEvtHandler()
|
|||||||
// search for m_handler in the handler list
|
// search for m_handler in the handler list
|
||||||
if ( m_win && m_handler )
|
if ( m_win && m_handler )
|
||||||
{
|
{
|
||||||
wxEvtHandler *handlerPrev = NULL,
|
if ( m_win->RemoveEventHandler(m_handler) )
|
||||||
*handler = m_win->GetEventHandler();
|
|
||||||
while ( handler )
|
|
||||||
{
|
{
|
||||||
if ( handler == m_handler )
|
delete m_handler;
|
||||||
{
|
|
||||||
wxEvtHandler *handlerNext = handler->GetNextHandler();
|
|
||||||
if ( handlerPrev )
|
|
||||||
{
|
|
||||||
handlerPrev->SetNextHandler(handlerNext);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_win->SetEventHandler(handlerNext);
|
|
||||||
}
|
|
||||||
|
|
||||||
handler->SetNextHandler(NULL);
|
|
||||||
delete handler;
|
|
||||||
m_handler = NULL;
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
handlerPrev = handler;
|
|
||||||
handler = handler->GetNextHandler();
|
|
||||||
}
|
}
|
||||||
|
//else: something is very wrong, so better [maybe] leak memory than
|
||||||
|
// risk a crash because of double deletion
|
||||||
|
|
||||||
wxFAIL_MSG( _T("where has our event handler gone?") );
|
m_handler = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user