git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@20353 
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
     
     while ( e->top != index )
     {
     
     while ( e->top != index )
     {
-        if ( index == kMaxEvents )
-            index = 0 ;
         if ( e->data[index] == data )
             e->data[index] = NULL ;
         index++ ;
         if ( e->data[index] == data )
             e->data[index] = NULL ;
         index++ ;
+        if ( index == kMaxEvents )
+            index = 0 ;
 
     
     while ( e->top != index )
     {
     
     while ( e->top != index )
     {
-        if ( index == kMaxEvents )
-            index = 0 ;
         if ( e->data[index] == data )
             e->data[index] = NULL ;
         index++ ;
         if ( e->data[index] == data )
             e->data[index] = NULL ;
         index++ ;
+        if ( index == kMaxEvents )
+            index = 0 ;