X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/acd15a3fa015caf2d1e3213a7694b05c92d5b49c..405d8f465740a78d2d19a2b108ac8fd65ff1a5e2:/src/common/event.cpp diff --git a/src/common/event.cpp b/src/common/event.cpp index 5e618cc09f..914df70855 100644 --- a/src/common/event.cpp +++ b/src/common/event.cpp @@ -629,6 +629,13 @@ void wxEvtHandler::AddPendingEvent(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") ); + #if defined(__VISAGECPP__) wxENTER_CRIT_SECT( m_eventsLocker); #else @@ -638,9 +645,7 @@ void wxEvtHandler::AddPendingEvent(wxEvent& event) if ( !m_pendingEvents ) m_pendingEvents = new wxList; - wxEvent *event2 = event.Clone(); - - m_pendingEvents->Append(event2); + m_pendingEvents->Append(eventCopy); #if defined(__VISAGECPP__) wxLEAVE_CRIT_SECT( m_eventsLocker);