diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-10-03 11:13:17 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-10-03 16:36:50 +0300 |
commit | a6ad80d9e852bb47e435915d9d491819d0947016 (patch) | |
tree | 8cba00e163d01cc025d58b2766d096643c21e2c5 /intern | |
parent | 3bbe01dad33c6a57c162c285b4097d689aa389a2 (diff) |
Fix T70125: crash on startup in Linux with some tablet types connected
Diffstat (limited to 'intern')
-rw-r--r-- | intern/ghost/intern/GHOST_SystemX11.cpp | 38 |
1 files changed, 21 insertions, 17 deletions
diff --git a/intern/ghost/intern/GHOST_SystemX11.cpp b/intern/ghost/intern/GHOST_SystemX11.cpp index e46edeeac9a..639553f31bb 100644 --- a/intern/ghost/intern/GHOST_SystemX11.cpp +++ b/intern/ghost/intern/GHOST_SystemX11.cpp @@ -2303,26 +2303,30 @@ void GHOST_SystemX11::refreshXInputDevices() /* Find how many pressure levels tablet has */ XAnyClassPtr ici = device_info[i].inputclassinfo; - for (int j = 0; j < xtablet.Device->num_classes; ++j) { - if (ici->c_class == ValuatorClass) { - XValuatorInfo *xvi = (XValuatorInfo *)ici; - xtablet.PressureLevels = xvi->axes[2].max_value; - - if (xvi->num_axes > 3) { - /* this is assuming that the tablet has the same tilt resolution in both - * positive and negative directions. It would be rather weird if it didn't.. */ - xtablet.XtiltLevels = xvi->axes[3].max_value; - xtablet.YtiltLevels = xvi->axes[4].max_value; - } - else { - xtablet.XtiltLevels = 0; - xtablet.YtiltLevels = 0; + if (ici != NULL) { + for (int j = 0; j < xtablet.Device->num_classes; ++j) { + if (ici->c_class == ValuatorClass) { + XValuatorInfo *xvi = (XValuatorInfo *)ici; + if (xvi->axes != NULL) { + xtablet.PressureLevels = xvi->axes[2].max_value; + + if (xvi->num_axes > 3) { + /* this is assuming that the tablet has the same tilt resolution in both + * positive and negative directions. It would be rather weird if it didn't.. */ + xtablet.XtiltLevels = xvi->axes[3].max_value; + xtablet.YtiltLevels = xvi->axes[4].max_value; + } + else { + xtablet.XtiltLevels = 0; + xtablet.YtiltLevels = 0; + } + + break; + } } - break; + ici = (XAnyClassPtr)(((char *)ici) + ici->length); } - - ici = (XAnyClassPtr)(((char *)ici) + ici->length); } m_xtablets.push_back(xtablet); |