xfree86: fix unbalanced input_lock/unlock in xf86NewInputDevice()

If a device couldn't be enabled we left the lock hanging.

This patch also removes the leftover OsReleaseSignals() call, now unnecessary.
Note that input_unlock() is later than previously OsReleaseSignals().
RemoveDevice() manipulates the input device and its file descriptors, it's
safer to put the input_unlock() call after RemoveDevice() to avoid events
coming in while the device is being removed.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
This commit is contained in:
Peter Hutterer 2016-08-12 12:06:18 +10:00
parent bf31d6f43e
commit dd4e21cb3a

View File

@ -957,10 +957,10 @@ xf86NewInputDevice(InputInfoPtr pInfo, DeviceIntPtr *pdev, BOOL enable)
input_lock(); input_lock();
EnableDevice(dev, TRUE); EnableDevice(dev, TRUE);
if (!dev->enabled) { if (!dev->enabled) {
OsReleaseSignals();
xf86Msg(X_ERROR, "Couldn't init device \"%s\"\n", pInfo->name); xf86Msg(X_ERROR, "Couldn't init device \"%s\"\n", pInfo->name);
RemoveDevice(dev, TRUE); RemoveDevice(dev, TRUE);
rval = BadMatch; rval = BadMatch;
input_unlock();
goto unwind; goto unwind;
} }
/* send enter/leave event, update sprite window */ /* send enter/leave event, update sprite window */