This reverts commit 9be9719d78af035c45ea4b191c21fab0ee54f198.
Under the right conditions, the 'tool' pointer can be NULL,
leading to the X server crashing. An easy way to trigger the
crash is to spam pad events (such as button presses) while
holding the stylus on the edge of proximity.

Rather than fix this with additional checks for NULL, Ping
clued me into a much more elegant (and bug-free) way to
implement the check for an I4 mouse. See next patch.
---
 src/wcmCommon.c |   17 +++++------------
 1 files changed, 5 insertions(+), 12 deletions(-)

diff --git a/src/wcmCommon.c b/src/wcmCommon.c
index 6b25101..ee138ba 100644
--- a/src/wcmCommon.c
+++ b/src/wcmCommon.c
@@ -59,8 +59,6 @@ static void commonDispatchDevice(WacomCommonPtr common,
                                 enum WacomSuppressMode suppress);
 static void sendAButton(InputInfoPtr pInfo, int button, int mask,
                        int first_val, int num_vals, int *valuators);
-static WacomToolPtr findTool(const WacomCommonPtr common,
-                            const WacomDeviceState *ds);
 
 /*****************************************************************************
  * Utility functions
@@ -905,16 +903,11 @@ void wcmEvent(WacomCommonPtr common, unsigned int channel,
        if (TabletHasFeature(common, WCM_ROTATION) &&
                TabletHasFeature(common, WCM_RING)) /* I4 */
        {
-               WacomToolPtr tool = findTool(common, &ds);
-               WacomDevicePtr toolpriv = tool->device->private;
-               if (tool && tool->device && IsCursor(toolpriv))
-               {
-                       /* convert Intuos4 mouse tilt to rotation */
-                       ds.rotation = wcmTilt2R(ds.tiltx, ds.tilty,
-                                               INTUOS4_CURSOR_ROTATION_OFFSET);
-                       ds.tiltx = 0;
-                       ds.tilty = 0;
-               }
+               /* convert Intuos4 mouse tilt to rotation */
+               ds.rotation = wcmTilt2R(ds.tiltx, ds.tilty,
+                                       INTUOS4_CURSOR_ROTATION_OFFSET);
+               ds.tiltx = 0;
+               ds.tilty = 0;
        }
 
        /* Optionally filter values only while in proximity */
-- 
1.7.7.1


------------------------------------------------------------------------------
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to