[PATCH v2 06/12] Xi: add FreeInputMask function

Peter Hutterer peter.hutterer at who-t.net
Tue Nov 8 19:41:37 PST 2011


Does what it says on the box, compliments MakeInputMask.

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
Changes to v1:
- Take double-pointer and reset it to NULL

 Xi/exevents.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/Xi/exevents.c b/Xi/exevents.c
index f530310..20495e7 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);
-- 
1.7.7


More information about the xorg-devel mailing list