]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/event.cpp
removed wxIsLoggingEnabled() as it could create the log target as an unwanted side...
[wxWidgets.git] / src / common / event.cpp
index e4401d231ffb4cb1b74d3745f2d95d4a940b25c1..9debc5b90a773b72457a6ea74ff436702ff5c98f 100644 (file)
     #pragma hdrstop
 #endif
 
+#include "wx/event.h"
+
 #ifndef WX_PRECOMP
-    #include "wx/app.h"
     #include "wx/list.h"
+    #include "wx/app.h"
+    #include "wx/utils.h"
 
     #if wxUSE_GUI
         #include "wx/control.h"
-        #include "wx/utils.h"
         #include "wx/dc.h"
         #include "wx/textctrl.h"
     #endif // wxUSE_GUI
 #endif
 
-#include "wx/event.h"
 #include "wx/module.h"
 
 #if wxUSE_GUI
@@ -736,10 +737,12 @@ wxKeyEvent::wxKeyEvent(const wxKeyEvent& evt)
 #endif
 }
 
+#if WXWIN_COMPATIBILITY_2_6
 long wxKeyEvent::KeyCode() const
 {
     return m_keyCode;
 }
+#endif // WXWIN_COMPATIBILITY_2_6
 
 wxWindowCreateEvent::wxWindowCreateEvent(wxWindow *win)
 {
@@ -1139,7 +1142,7 @@ void wxEvtHandler::ProcessPendingEvents()
 
         wxENTER_CRIT_SECT( Lock() );
 
-        if ( !--n )
+        if ( --n == 0 )
             break;
     }
 
@@ -1344,6 +1347,10 @@ bool wxEvtHandler::SearchDynamicEventTable( wxEvent& event )
         wxDynamicEventTableEntry *entry = (wxDynamicEventTableEntry*)node->GetData();
 #endif // WXWIN_COMPATIBILITY_EVENT_TYPES/!WXWIN_COMPATIBILITY_EVENT_TYPES
 
+        // get next node before (maybe) calling the event handler as it could
+        // call Disconnect() invalidating the current node
+        node = node->GetNext();
+
         if ((event.GetEventType() == entry->m_eventType) && (entry->m_fn != 0))
         {
             wxEvtHandler *handler =
@@ -1358,8 +1365,6 @@ bool wxEvtHandler::SearchDynamicEventTable( wxEvent& event )
                 return true;
             }
         }
-
-        node = node->GetNext();
     }
 
     return false;