X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c9f7896861f734ce044ee8601ba2d8a6959c9d9e..ad653fa23069c5d9378247084f03c9a718c3ad62:/src/unix/joystick.cpp?ds=sidebyside diff --git a/src/unix/joystick.cpp b/src/unix/joystick.cpp index 15f49db961..27b3b6cb74 100644 --- a/src/unix/joystick.cpp +++ b/src/unix/joystick.cpp @@ -19,8 +19,11 @@ #ifndef WX_PRECOMP #include "wx/event.h" #include "wx/window.h" + #include "wx/log.h" #endif //WX_PRECOMP +#include "wx/thread.h" + #include #include #include @@ -100,7 +103,7 @@ void wxJoystickThread::SendEvent(wxEventType type, long ts, int change) jwx_event.SetEventObject(m_catchwin); if (m_catchwin) - m_catchwin->AddPendingEvent(jwx_event); + m_catchwin->GetEventHandler()->AddPendingEvent(jwx_event); } void* wxJoystickThread::Entry() @@ -134,6 +137,14 @@ void* wxJoystickThread::Entry() if ((j_evt.type & JS_EVENT_AXIS) && (j_evt.number < wxJS_MAX_AXES)) { + // Ignore invalid axis. + if ( j_evt.number >= wxJS_MAX_AXES ) + { + wxLogDebug(wxS("Invalid axis index %d in joystick message."), + j_evt.number); + continue; + } + if ( (m_axe[j_evt.number] + m_threshold < j_evt.value) || (m_axe[j_evt.number] - m_threshold > j_evt.value) ) {