added wxQueueEvent() avoiding the bug of wxPostEvent() with the events having wxString fields

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@53405 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2008-04-28 18:49:42 +00:00
parent d38e30d1d2
commit c3f941621e
4 changed files with 127 additions and 40 deletions

View File

@@ -1130,23 +1130,17 @@ bool wxEvtHandler::ProcessThreadEvent(const wxEvent& event)
#endif // wxUSE_THREADS
void wxEvtHandler::AddPendingEvent(const wxEvent& event)
void wxEvtHandler::QueueEvent(wxEvent *event)
{
// 1) Add event to list of pending events of this event handler
wxEvent *eventCopy = event.Clone();
// we must be able to copy the events here so the event class must
// implement Clone() properly instead of just providing a NULL stab for it
wxCHECK_RET( eventCopy,
_T("events of this type aren't supposed to be posted") );
wxCHECK_RET( event, "NULL event can't be posted" );
// 1) Add this event to our list of pending events
wxENTER_CRIT_SECT( m_pendingEventsLock );
if ( !m_pendingEvents )
m_pendingEvents = new wxList;
m_pendingEvents->Append(eventCopy);
m_pendingEvents->Append(event);
wxLEAVE_CRIT_SECT( m_pendingEventsLock );