From 9802839d35aaf788790f1d0e8300db4693a70096 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Fri, 7 May 2010 16:22:12 +1000 Subject: [PATCH] Xi: reset the known properties at the end of the server generation. Properties allocated through XIGetKnownProperty() aren't reset on the second server generation but keep the old value. As a result, wrong Atoms are supplied to the driver, resulting in potential data corruption or weird error message. Reproducible by running "xlsatom | grep FLOAT" twice on a plain X server. The second X server generation won't have the FLOAT atom defined anymore, despite the users of this atom not noticing any errors. Signed-off-by: Peter Hutterer Reviewed-by: Julien Cristau Signed-off-by: Keith Packard --- Xi/extinit.c | 1 + Xi/xiproperty.c | 9 +++++++++ Xi/xiproperty.h | 3 +++ 3 files changed, 13 insertions(+) diff --git a/Xi/extinit.c b/Xi/extinit.c index b7910cd13..37f985664 100644 --- a/Xi/extinit.c +++ b/Xi/extinit.c @@ -1122,6 +1122,7 @@ RestoreExtensionEvents(void) static void IResetProc(ExtensionEntry * unused) { + XIResetProperties(); ReplySwapVector[IReqCode] = ReplyNotSwappd; EventSwapVector[DeviceValuator] = NotImplemented; diff --git a/Xi/xiproperty.c b/Xi/xiproperty.c index be0783107..8b8063776 100644 --- a/Xi/xiproperty.c +++ b/Xi/xiproperty.c @@ -403,6 +403,15 @@ XIGetKnownProperty(char *name) return 0; } +void +XIResetProperties(void) +{ + int i; + + for (i = 0; i < (sizeof(dev_properties)/sizeof(struct dev_properties)); i++) + dev_properties[i].type = None; +} + /** * Convert the given property's value(s) into @nelem_return integer values and * store them in @buf_return. If @nelem_return is larger than the number of diff --git a/Xi/xiproperty.h b/Xi/xiproperty.h index 69b41fafd..d8b886379 100644 --- a/Xi/xiproperty.h +++ b/Xi/xiproperty.h @@ -62,4 +62,7 @@ void SRepXIListProperties(ClientPtr client, int size, xXIListPropertiesReply *rep); void SRepXIGetProperty(ClientPtr client, int size, xXIGetPropertyReply *rep); + +void XIResetProperties(void); + #endif /* XIPROPERTY_H */