[PATCH] Don't destroy the timer on DeviceOff.

Adam Jackson ajax at redhat.com
Thu Dec 10 10:33:37 PST 2009


DeviceOff is VT switch, DeviceClose is unplug.  We need the timer
pre-allocated since we set it during the signal handler and so can't
allocate it then, so merely cancel it at DeviceOff, and delete it in
DeviceClose.

Signed-off-by: Adam Jackson <ajax at redhat.com>
---
 src/synaptics.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/synaptics.c b/src/synaptics.c
index d9b8f50..0fdc496 100644
--- a/src/synaptics.c
+++ b/src/synaptics.c
@@ -779,8 +779,7 @@ DeviceOff(DeviceIntPtr dev)
     DBG(3, "Synaptics DeviceOff called\n");
 
     if (local->fd != -1) {
-	TimerFree(priv->timer);
-	priv->timer = NULL;
+	TimerCancel(priv->timer);
 	xf86RemoveEnabledDevice(local);
         if (priv->proto_ops->DeviceOffHook)
             priv->proto_ops->DeviceOffHook(local);
@@ -802,6 +801,8 @@ DeviceClose(DeviceIntPtr dev)
     SynapticsPrivate *priv = (SynapticsPrivate *) local->private;
 
     RetValue = DeviceOff(dev);
+    TimerFree(priv->timer);
+    priv->timer = NULL;
     free_param_data(priv);
     return RetValue;
 }
-- 
1.6.5.2



More information about the xorg-devel mailing list