mirror of
https://github.com/X11Libre/xserver.git
synced 2026-04-14 17:18:09 +00:00
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.
This commit is contained in:
12
dix/grabs.c
12
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))
|
||||
|
||||
Reference in New Issue
Block a user