+
+#if wxUSE_THREADS
+ if (m_pendingEvents)
+ delete m_pendingEvents;
+
+ delete m_eventsLocker;
+#endif
+}
+
+#if wxUSE_THREADS
+bool wxEvtHandler::ProcessThreadEvent(wxEvent& event)
+{
+ wxEvent *event_main;
+ wxCriticalSectionLocker locker(*m_eventsLocker);
+
+ // check that we are really in a child thread
+ wxASSERT( !wxThread::IsMain() );
+
+ if (m_pendingEvents == NULL)
+ m_pendingEvents = new wxList();
+
+ event_main = (wxEvent *)event.Clone();
+
+ m_pendingEvents->Append(event_main);
+
+ wxPendingEventsLocker->Enter();
+ wxPendingEvents->Append(this);
+ wxPendingEventsLocker->Leave();
+
+ return TRUE;
+}
+
+void wxEvtHandler::ProcessPendingEvents()
+{
+ wxCriticalSectionLocker locker(*m_eventsLocker);
+ wxNode *node = m_pendingEvents->First();
+ wxEvent *event;
+
+ while (node != NULL) {
+ event = (wxEvent *)node->Data();
+ ProcessEvent(*event);
+ delete node;
+ node = m_pendingEvents->First();
+ }