Re: [PATCH] dix: disable all devices before shutdown

2012-05-09 Thread Chase Douglas
On 05/08/2012 04:26 PM, Peter Hutterer wrote:
 f3410b97cf9b48a47bee3d15d232f8a88e75f4ef introduced a regression on server
 shutdown. If any button or key was held on shutdown (ctrl, alt, backspace
 are usually still down) sending a raw event will segfault the server. The
 the root windows are set to NULL before calling CloseDownDevices().
 
 Avoid this by disabling all devices first when shutting down. Disabled
 devices won't send events anymore.
 
 Signed-off-by: Peter Hutterer peter.hutte...@who-t.net

Looks good to me.

Reviewed-by: Chase Douglas chase.doug...@canonical.com
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel


Re: [PATCH] dix: disable all devices before shutdown

2012-05-09 Thread Julien Cristau
On Wed, May  9, 2012 at 09:26:00 +1000, Peter Hutterer wrote:

 f3410b97cf9b48a47bee3d15d232f8a88e75f4ef introduced a regression on server
 shutdown. If any button or key was held on shutdown (ctrl, alt, backspace
 are usually still down) sending a raw event will segfault the server. The
 the root windows are set to NULL before calling CloseDownDevices().
 
 Avoid this by disabling all devices first when shutting down. Disabled
 devices won't send events anymore.
 
 Signed-off-by: Peter Hutterer peter.hutte...@who-t.net
 ---
  dix/devices.c   |   15 +++
  dix/main.c  |4 
  include/input.h |2 +-
  3 files changed, 20 insertions(+), 1 deletion(-)
 
One of the people who reported the corresponding debian bug says this
fixes the crash, but he gets [dix] cannot disable device, still paired.
This is a bug. twice on shutdown now.  Not sure if this is expected?

Cheers,
Julien


signature.asc
Description: Digital signature
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Re: [PATCH] dix: disable all devices before shutdown

2012-05-09 Thread Peter Hutterer
On Wed, May 09, 2012 at 09:31:23PM +0200, Julien Cristau wrote:
 On Wed, May  9, 2012 at 09:26:00 +1000, Peter Hutterer wrote:
 
  f3410b97cf9b48a47bee3d15d232f8a88e75f4ef introduced a regression on server
  shutdown. If any button or key was held on shutdown (ctrl, alt, backspace
  are usually still down) sending a raw event will segfault the server. The
  the root windows are set to NULL before calling CloseDownDevices().
  
  Avoid this by disabling all devices first when shutting down. Disabled
  devices won't send events anymore.
  
  Signed-off-by: Peter Hutterer peter.hutte...@who-t.net
  ---
   dix/devices.c   |   15 +++
   dix/main.c  |4 
   include/input.h |2 +-
   3 files changed, 20 insertions(+), 1 deletion(-)
  
 One of the people who reported the corresponding debian bug says this
 fixes the crash, but he gets [dix] cannot disable device, still paired.
 This is a bug. twice on shutdown now.  Not sure if this is expected?

I'll have a look, didn't see that message yesterday but I know where it
comes from.

Cheers,
  Peter
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel


[PATCH] dix: disable all devices before shutdown

2012-05-08 Thread Peter Hutterer
f3410b97cf9b48a47bee3d15d232f8a88e75f4ef introduced a regression on server
shutdown. If any button or key was held on shutdown (ctrl, alt, backspace
are usually still down) sending a raw event will segfault the server. The
the root windows are set to NULL before calling CloseDownDevices().

Avoid this by disabling all devices first when shutting down. Disabled
devices won't send events anymore.

Signed-off-by: Peter Hutterer peter.hutte...@who-t.net
---
 dix/devices.c   |   15 +++
 dix/main.c  |4 
 include/input.h |2 +-
 3 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/dix/devices.c b/dix/devices.c
index 51a74b6..ca298b2 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -501,6 +501,21 @@ DisableDevice(DeviceIntPtr dev, BOOL sendevent)
 return TRUE;
 }
 
+void
+DisableAllDevices(void)
+{
+DeviceIntPtr dev, tmp;
+
+nt_list_for_each_entry_safe(dev, tmp, inputInfo.devices, next) {
+if (!IsMaster(dev))
+DisableDevice(dev, FALSE);
+}
+nt_list_for_each_entry_safe(dev, tmp, inputInfo.devices, next) {
+if (dev-enabled)
+DisableDevice(dev, FALSE);
+}
+}
+
 /**
  * Initialise a new device through the driver and tell all clients about the
  * new device.
diff --git a/dix/main.c b/dix/main.c
index 70dcc94..df9023e 100644
--- a/dix/main.c
+++ b/dix/main.c
@@ -104,6 +104,7 @@ Equipment Corporation.
 #include privates.h
 #include registry.h
 #include client.h
+#include exevents.h
 #ifdef PANORAMIX
 #include panoramiXsrv.h
 #else
@@ -295,6 +296,7 @@ main(int argc, char *argv[], char *envp[])
 #endif
 
 UndisplayDevices();
+DisableAllDevices();
 
 /* Now free up whatever must be freed */
 if (screenIsSaved == SCREEN_SAVER_ON)
@@ -318,7 +320,9 @@ main(int argc, char *argv[], char *envp[])
 
 for (i = 0; i  screenInfo.numScreens; i++)
 screenInfo.screens[i]-root = NullWindow;
+
 CloseDownDevices();
+
 CloseDownEvents();
 
 for (i = screenInfo.numScreens - 1; i = 0; i--) {
diff --git a/include/input.h b/include/input.h
index 0e58280..3f62ec9 100644
--- a/include/input.h
+++ b/include/input.h
@@ -264,7 +264,7 @@ extern _X_EXPORT Bool ActivateDevice(DeviceIntPtr /*device 
*/ ,
 
 extern _X_EXPORT Bool DisableDevice(DeviceIntPtr /*device */ ,
 BOOL /* sendevent */ );
-
+extern void DisableAllDevices(void);
 extern int InitAndStartDevices(void);
 
 extern void CloseDownDevices(void);
-- 
1.7.10.1

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel