X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8e72b8b51770b59a83eb32f4d766b89f6c4dc615..4f61e22c77b1a7cb148f6567996d816f72ac854f:/src/common/event.cpp diff --git a/src/common/event.cpp b/src/common/event.cpp index 6bdc802f27..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 = (wxEvent *)event.Clone(); - - m_pendingEvents->Append(event2); + m_pendingEvents->Append(eventCopy); #if defined(__VISAGECPP__) wxLEAVE_CRIT_SECT( m_eventsLocker); @@ -711,8 +716,8 @@ bool wxEvtHandler::ProcessEvent(wxEvent& event) { #if wxUSE_GUI - // We have to use the actual window or processing events from wxWindowNative - // destructor won't work (we don't see the wxWindow class) + // We have to use the actual window or processing events from + // wxWindowNative destructor won't work (we don't see the wxWindow class) #ifdef __WXDEBUG__ // check that our flag corresponds to reality wxClassInfo* info = NULL; @@ -735,7 +740,7 @@ bool wxEvtHandler::ProcessEvent(wxEvent& event) #endif wxASSERT_MSG( m_isWindow == IsKindOf(info), - _T("this should [not] be a window but it is [not]") ); + wxString(GetClassInfo()->GetClassName()) + _T(" should [not] be a window but it is [not]") ); #endif #endif // wxUSE_GUI