xserver: Branch 'server-1.5-branch' - 3 commits

Peter Hutterer whot at kemper.freedesktop.org
Tue Jul 15 18:42:37 PDT 2008


 Xi/exevents.c                  |    2 +
 dix/main.c                     |    3 ++
 hw/xfree86/common/xf86Init.c   |   60 +++++++++++++++++++----------------------
 hw/xfree86/common/xf86Xinput.c |   18 +++++++++---
 4 files changed, 48 insertions(+), 35 deletions(-)

New commits:
commit 45f274415d8f7dfc18f395783cd7c5dbd4a43c4f
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date:   Thu Apr 24 13:30:28 2008 +0930

    Xi: don't attempt to send to a NULL window.
    
    Only applicable when the server comes down/restarts. In this case,
    WindowTable[i] may be NULL. Let's not try to send an event then.
    (cherry picked from commit f377141912594f87144d6d7f7fdd279a101d8e6c)

diff --git a/Xi/exevents.c b/Xi/exevents.c
index c03f796..0b312f5 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -1284,6 +1284,8 @@ SendEventToAllWindows(DeviceIntPtr dev, Mask mask, xEvent * ev, int count)
 
     for (i = 0; i < screenInfo.numScreens; i++) {
         pWin = WindowTable[i];
+        if (!pWin)
+            continue;
         (void)DeliverEventsToWindow(pWin, ev, count, mask, NullGrab, dev->id);
         p1 = pWin->firstChild;
         FindInterestedChildren(dev, p1, mask, ev, count);
commit 476de585bee851ea592af043652aa7525bc8d3ce
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date:   Thu Apr 24 13:29:46 2008 +0930

    dix: NULL out WindowTable after freeing all the windows.
    
    CloseDownDevices() tries to send PresenceNotify events. If the windows are
    already freed, then we are accessing dangling pointers.
    (cherry picked from commit aec485f2dcc87b340759d67b60e7dee7931aaec5)

diff --git a/dix/main.c b/dix/main.c
index db43473..6d9dd33 100644
--- a/dix/main.c
+++ b/dix/main.c
@@ -458,7 +458,10 @@ main(int argc, char *argv[], char *envp[])
 #endif
 
         config_fini();
+
+        memset(WindowTable, 0, MAXSCREENS * sizeof(WindowPtr));
 	CloseDownDevices();
+
 	for (i = screenInfo.numScreens - 1; i >= 0; i--)
 	{
 	    FreeScratchPixmapsForScreen(i);
commit 5cb38a3fcabb1b46fc24584f5e42d28a9a2dc703
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date:   Wed Apr 23 11:38:08 2008 +0930

    xfree86: don't free the config-file related information in DIDR. #15645
    
    In DeleteInputDeviceRequest, leave the conf_idev (which is shared with
    xf86ConfigLayout.input) alone for devices that were specified in the
    ServerLayout section of the config file. This way, in the next server
    generation we are left with what was the original config and can thus re-init
    the devices.
    
    This is an addon to 6d22a9615a0e6ab3d00b0bcb22ff001b6ece02ae, an attempt to
    fix Bug 14418.
    
    X.Org Bug 15645 <https://bugs.freedesktop.org/show_bug.cgi?id=15645>
    X.Org Bug 14418 <https://bugs.freedesktop.org/show_bug.cgi?id=15645>
    (cherry picked from commit 9ab4e2fd8eaa87dbd16835affb1aa54dcb1a619e)

diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c
index 6d5eaad..68dc387 100644
--- a/hw/xfree86/common/xf86Init.c
+++ b/hw/xfree86/common/xf86Init.c
@@ -1123,37 +1123,35 @@ InitInput(argc, argv)
     xf86Info.vtRequestsPending = FALSE;
     xf86Info.inputPending = FALSE;
 
-    if (serverGeneration == 1) {
-	/* Call the PreInit function for each input device instance. */
-	for (pDev = xf86ConfigLayout.inputs; pDev && *pDev; pDev++) {
-	    /* Replace obsolete keyboard driver with kbd */
-	    if (!xf86NameCmp((*pDev)->driver, "keyboard")) {
-		strcpy((*pDev)->driver, "kbd");
-            }
-
-	    if ((pDrv = xf86LookupInputDriver((*pDev)->driver)) == NULL) {
-		xf86Msg(X_ERROR, "No Input driver matching `%s'\n", (*pDev)->driver);
-		/* XXX For now, just continue. */
-		continue;
-	    }
-	    if (!pDrv->PreInit) {
-		xf86MsgVerb(X_WARNING, 0,
-		    "Input driver `%s' has no PreInit function (ignoring)\n",
-		    pDrv->driverName);
-		continue;
-	    }
-	    pInfo = pDrv->PreInit(pDrv, *pDev, 0);
-	    if (!pInfo) {
-		xf86Msg(X_ERROR, "PreInit returned NULL for \"%s\"\n",
-			(*pDev)->identifier);
-		continue;
-	    } else if (!(pInfo->flags & XI86_CONFIGURED)) {
-		xf86Msg(X_ERROR, "PreInit failed for input device \"%s\"\n",
-			(*pDev)->identifier);
-		xf86DeleteInput(pInfo, 0);
-		continue;
-	    }
-	}
+    /* Call the PreInit function for each input device instance. */
+    for (pDev = xf86ConfigLayout.inputs; pDev && *pDev; pDev++) {
+        /* Replace obsolete keyboard driver with kbd */
+        if (!xf86NameCmp((*pDev)->driver, "keyboard")) {
+            strcpy((*pDev)->driver, "kbd");
+        }
+
+        if ((pDrv = xf86LookupInputDriver((*pDev)->driver)) == NULL) {
+            xf86Msg(X_ERROR, "No Input driver matching `%s'\n", (*pDev)->driver);
+            /* XXX For now, just continue. */
+            continue;
+        }
+        if (!pDrv->PreInit) {
+            xf86MsgVerb(X_WARNING, 0,
+                    "Input driver `%s' has no PreInit function (ignoring)\n",
+                    pDrv->driverName);
+            continue;
+        }
+        pInfo = pDrv->PreInit(pDrv, *pDev, 0);
+        if (!pInfo) {
+            xf86Msg(X_ERROR, "PreInit returned NULL for \"%s\"\n",
+                    (*pDev)->identifier);
+            continue;
+        } else if (!(pInfo->flags & XI86_CONFIGURED)) {
+            xf86Msg(X_ERROR, "PreInit failed for input device \"%s\"\n",
+                    (*pDev)->identifier);
+            xf86DeleteInput(pInfo, 0);
+            continue;
+        }
     }
 
     /* Initialise all input devices. */
diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c
index d34238e..710e787 100644
--- a/hw/xfree86/common/xf86Xinput.c
+++ b/hw/xfree86/common/xf86Xinput.c
@@ -448,6 +448,8 @@ DeleteInputDeviceRequest(DeviceIntPtr pDev)
     LocalDevicePtr pInfo = (LocalDevicePtr) pDev->public.devicePrivate;
     InputDriverPtr drv;
     IDevRec *idev;
+    BOOL found;
+    IDevPtr *it;
 
     if (pInfo) /* need to get these before RemoveDevice */
     {
@@ -464,10 +466,18 @@ DeleteInputDeviceRequest(DeviceIntPtr pDev)
     else
         xf86DeleteInput(pInfo, 0);
 
-    xfree(idev->driver);
-    xfree(idev->identifier);
-    xf86optionListFree(idev->commonOptions);
-    xfree(idev);
+    /* devices added through HAL aren't in the config layout */
+    it = xf86ConfigLayout.inputs;
+    while(*it && *it != idev)
+        it++;
+
+    if (!(*it)) /* end of list, not in the layout */
+    {
+        xfree(idev->driver);
+        xfree(idev->identifier);
+        xf86optionListFree(idev->commonOptions);
+        xfree(idev);
+    }
 }
 
 /* 


More information about the xorg-commit mailing list