From c9a5f9d3911c2e6a8f81b0721c9eb914fb7719b5 Mon Sep 17 00:00:00 2001 From: Alan Hourihane Date: Sat, 18 Nov 2006 19:55:42 +0000 Subject: Shutdown input devices if FatalError occurs during startup. Fixes Xdmx problems when the input device has been initialized and the keyboard map has been destroyed. --- dix/main.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/dix/main.c b/dix/main.c index 88d775571..bee5490fd 100644 --- a/dix/main.c +++ b/dix/main.c @@ -414,21 +414,27 @@ main(int argc, char *argv[], char *envp[]) ErrorF("failed to set default font path '%s'", defaultFontPath); } - if (!SetDefaultFont(defaultTextFont)) + if (!SetDefaultFont(defaultTextFont)) { + CloseDownDevices(); FatalError("could not open default font '%s'", defaultTextFont); + } #ifdef NULL_ROOT_CURSOR cm.width = 0; cm.height = 0; cm.xhot = 0; cm.yhot = 0; - if (!(rootCursor = AllocCursor(NULL, NULL, &cm, 0, 0, 0, 0, 0, 0))) + if (!(rootCursor = AllocCursor(NULL, NULL, &cm, 0, 0, 0, 0, 0, 0))) { + CloseDownDevices(); FatalError("could not create empty root cursor"); + } AddResource(FakeClientID(0), RT_CURSOR, (pointer)rootCursor); #else - if (!(rootCursor = CreateRootCursor(defaultCursorFont, 0))) + if (!(rootCursor = CreateRootCursor(defaultCursorFont, 0))) { + CloseDownDevices(); FatalError("could not open default cursor font '%s'", defaultCursorFont); + } #endif #ifdef DPMSExtension /* check all screens, looking for DPMS Capabilities */ @@ -452,13 +458,17 @@ main(int argc, char *argv[], char *envp[]) #ifdef PANORAMIX if (!noPanoramiXExtension) { - if (!PanoramiXCreateConnectionBlock()) + if (!PanoramiXCreateConnectionBlock()) { + CloseDownDevices(); FatalError("could not create connection block info"); + } } else #endif { - if (!CreateConnectionBlock()) + if (!CreateConnectionBlock()) { + CloseDownDevices(); FatalError("could not create connection block info"); + } } Dispatch(); -- cgit v1.2.3