summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter@cs.unisa.edu.au>2007-06-29 11:56:18 +0930
committerPeter Hutterer <peter@cs.unisa.edu.au>2007-06-29 11:56:18 +0930
commit2691c05fd647d9fa10f791ac397ecb9c423a076f (patch)
treea5f4039a1db8b2a4009f1a3cac94d2cf2b12ed81
parentf7f3fe7fe7233a2ffc43106c48f44cbbd82b7c19 (diff)
Make sure window->optional is allocated before assigning it.
DeletePassiveGrabFromList() may remove the window optional, so we need to re-alloc it if it isn't there anymore. Thanks to Colin Harrison for spotting the bug.
-rw-r--r--dix/grabs.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/dix/grabs.c b/dix/grabs.c
index cecd7ec39..2210cd05e 100644
--- a/dix/grabs.c
+++ b/dix/grabs.c
@@ -322,12 +322,6 @@ AddPassiveGrabToList(GrabPtr pGrab)
}
}
- if (!pGrab->window->optional && !MakeWindowOptional (pGrab->window))
- {
- FreeGrab(pGrab);
- return BadAlloc;
- }
-
/* Remove all grabs that match the new one exactly */
for (grab = wPassiveGrabs(pGrab->window); grab; grab = grab->next)
{
@@ -338,6 +332,12 @@ AddPassiveGrabToList(GrabPtr pGrab)
}
}
+ if (!pGrab->window->optional && !MakeWindowOptional (pGrab->window))
+ {
+ FreeGrab(pGrab);
+ return BadAlloc;
+ }
+
pGrab->next = pGrab->window->optional->passiveGrabs;
pGrab->window->optional->passiveGrabs = pGrab;
if (AddResource(pGrab->resource, RT_PASSIVEGRAB, (pointer)pGrab))