fix memory leak of pending events in wxEvtHandler dtor
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@36118 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1084,7 +1084,10 @@ void wxEvtHandler::AddPendingEvent(wxEvent& event)
|
||||
wxENTER_CRIT_SECT( Lock() );
|
||||
|
||||
if ( !m_pendingEvents )
|
||||
{
|
||||
m_pendingEvents = new wxList;
|
||||
m_pendingEvents->DeleteContents(true);
|
||||
}
|
||||
|
||||
m_pendingEvents->Append(eventCopy);
|
||||
|
||||
@@ -1126,15 +1129,14 @@ void wxEvtHandler::ProcessPendingEvents()
|
||||
{
|
||||
wxEvent *event = (wxEvent *)node->GetData();
|
||||
|
||||
m_pendingEvents->Erase(node);
|
||||
|
||||
wxLEAVE_CRIT_SECT( Lock() );
|
||||
|
||||
ProcessEvent(*event);
|
||||
delete event;
|
||||
|
||||
wxENTER_CRIT_SECT( Lock() );
|
||||
|
||||
m_pendingEvents->Erase(node);
|
||||
|
||||
if ( !--n )
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user