Discussion:
[Linuxwacom-devel] [PATCH] Cancel timers on DEVICE_OFF
Peter Hutterer
2017-02-24 04:11:35 UTC
Permalink
Otherwise we run the risk of having a timer trigger after we removed the
device. Since we pass InputInfoPtrs and WacomDevicePtrs to the timers as
arguments, these may have been freed by the time a timer triggers.

Signed-off-by: Peter Hutterer <***@who-t.net>
---
src/xf86Wacom.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/src/xf86Wacom.c b/src/xf86Wacom.c
index b4cf25b..26b4e9c 100644
--- a/src/xf86Wacom.c
+++ b/src/xf86Wacom.c
@@ -854,6 +854,9 @@ static int wcmDevProc(DeviceIntPtr pWcm, int what)
break;

case DEVICE_OFF:
+ TimerCancel(priv->tap_timer);
+ TimerCancel(priv->serial_timer);
+ TimerCancel(priv->touch_timer);
wcmDisableTool(pWcm);
wcmUnlinkTouchAndPen(pInfo);
if (pInfo->fd >= 0)
--
2.9.3
Jason Gerecke
2017-02-24 23:20:04 UTC
Permalink
Looks reasonable enough to me. Acked-by and pushed.

Jason
---
Now instead of four in the eights place /
you’ve got three, ‘Cause you added one /
(That is to say, eight) to the two, /
But you can’t take seven from three, /
So you look at the sixty-fours....



On Thu, Feb 23, 2017 at 8:11 PM, Peter Hutterer
Post by Peter Hutterer
Otherwise we run the risk of having a timer trigger after we removed the
device. Since we pass InputInfoPtrs and WacomDevicePtrs to the timers as
arguments, these may have been freed by the time a timer triggers.
---
src/xf86Wacom.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/xf86Wacom.c b/src/xf86Wacom.c
index b4cf25b..26b4e9c 100644
--- a/src/xf86Wacom.c
+++ b/src/xf86Wacom.c
@@ -854,6 +854,9 @@ static int wcmDevProc(DeviceIntPtr pWcm, int what)
break;
+ TimerCancel(priv->tap_timer);
+ TimerCancel(priv->serial_timer);
+ TimerCancel(priv->touch_timer);
wcmDisableTool(pWcm);
wcmUnlinkTouchAndPen(pInfo);
if (pInfo->fd >= 0)
--
2.9.3
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Linuxwacom-devel mailing list
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel
Loading...