On 10/08/2010 05:33, Keith Packard wrote:
On Sat,  7 Aug 2010 14:32:26 +0100, Jon TURNEY<[email protected]>  
wrote:

+    if (!rootlessWindowPrivateKeyRec.initialized)
+        return FALSE;
+

Please use the function 'dixPrivateKeyRegistered' instead of looking
inside the structure.

Thanks for pointing out the existence of that function. Amended patch attached.
>From 5cc312de6f6482336518ee27a9fab1d91b1ca7ff Mon Sep 17 00:00:00 2001
From: Jon TURNEY <[email protected]>
Date: Tue, 3 Aug 2010 19:49:10 +0100
Subject: [PATCH] rootless: fix uninitialized private key assert in non-rootless 
modes in Cygwin/X

IsFramedWindow() is called from miPaintWindow() if the server has
been built with ROOTLESS defined, irrespective of if RootlessInit()
has ever been called, or not.

Add a check to IsFramedWindow() to check if rootlessWindowPrivateKey
has been registered (as a proxy for checking if the rootless extension
has been initialized) so we don't go on to try to use that key,
triggering an assert.

This bug exposes what appears to be a difference in opinion about
the rootless extension between XQuartz and XWin.  XQuartz always
initializes the rootless extension, whereas XWin offers several modes
of operation, and the rootless extension is only used for one of them

That probably means that the all code under compile time guard for
ROOTLESS should be carefully checked that it doesn't also need to be
under a run-time guard

Signed-off-by: Jon TURNEY <[email protected]>
---
 miext/rootless/rootlessCommon.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/miext/rootless/rootlessCommon.c b/miext/rootless/rootlessCommon.c
index 82fe0b9..f91cfb4 100644
--- a/miext/rootless/rootlessCommon.c
+++ b/miext/rootless/rootlessCommon.c
@@ -92,6 +92,9 @@ IsFramedWindow(WindowPtr pWin)
 {
     WindowPtr top;
 
+    if (!dixPrivateKeyRegistered(&rootlessWindowPrivateKeyRec))
+        return FALSE;
+
     if (!pWin->realized)
         return FALSE;
     top = TopLevelParent(pWin);
-- 
1.7.1

_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to