From 61ef4daf6450da573b9de72ba7b200566821b916 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Fri, 4 Nov 2011 15:49:23 +1000 Subject: [PATCH] Xi: add FreeInputMask function Does what it says on the box, complements MakeInputMask. Signed-off-by: Peter Hutterer Reviewed-by: Chase Douglas --- Xi/exevents.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Xi/exevents.c b/Xi/exevents.c index f53031013..20495e74d 100644 --- a/Xi/exevents.c +++ b/Xi/exevents.c @@ -1678,6 +1678,13 @@ MakeInputMasks(WindowPtr pWin) return TRUE; } +static void +FreeInputMask(OtherInputMasks **imask) +{ + free(*imask); + *imask = NULL; +} + void RecalculateDeviceDeliverableEvents(WindowPtr pWin) { @@ -1737,8 +1744,9 @@ InputClientGone(WindowPtr pWin, XID id) FreeInputClient(&other); } else if (!(other->next)) { if (ShouldFreeInputMasks(pWin, TRUE)) { - wOtherInputMasks(pWin)->inputClients = other->next; - free(wOtherInputMasks(pWin)); + OtherInputMasks *mask = wOtherInputMasks(pWin); + mask->inputClients = other->next; + FreeInputMask(&mask); pWin->optional->inputMasks = (OtherInputMasks *) NULL; CheckWindowOptionalNeed(pWin); FreeInputClient(&other);