<div dir="ltr">I'm assuming FreeGrab explicitly does not allow NULLs because an unwanted instance of NULL would be quite the bug.<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Jul 12, 2013 at 8:28 AM, walter harms <span dir="ltr"><<a href="mailto:wharms@bfs.de" target="_blank">wharms@bfs.de</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
<br>
Am 11.07.2013 21:04, schrieb Peter Hutterer:<br>
<div><div class="h5">> If a client calls XIGrabDevice in response to a ButtonPress event (regular<br>
> event selection), the device will have a grab, but listener->grab is NULL.<br>
><br>
> Check for that, to avoid logspam.<br>
><br>
> [ 26293.863] (EE) BUG: triggered 'if (!pGrab)'<br>
> [ 26293.863] (EE) BUG: grabs.c:256 in FreeGrab()<br>
> [ 26293.863] (EE)<br>
> [ 26293.863] (EE) Backtrace:<br>
> [ 26293.864] (EE) 0: /usr/bin/Xorg (FreeGrab+0x54) [0x45d3fc]<br>
> [ 26293.864] (EE) 1: /usr/bin/Xorg (UpdateTouchesForGrab+0x135) [0x447d4e]<br>
> [ 26293.864] (EE) 2: /usr/bin/Xorg (ActivatePointerGrab+0x1ba) [0x447f3d]<br>
> [ 26293.864] (EE) 3: /usr/bin/Xorg (GrabDevice+0x3e6) [0x4503bc]<br>
> [ 26293.864] (EE) 4: /usr/bin/Xorg (ProcXIGrabDevice+0x1f9) [0x5981b1]<br>
> [ 26293.865] (EE) 5: /usr/bin/Xorg (ProcIDispatch+0x78) [0x58aa17]<br>
> [ 26293.865] (EE) 6: /usr/bin/Xorg (Dispatch+0x30d) [0x43347e]<br>
> [ 26293.865] (EE) 7: /usr/bin/Xorg (main+0x61d) [0x498175]<br>
> [ 26293.865] (EE) 8: /lib64/libc.so.6 (__libc_start_main+0xf5) [0x3df5621b75]<br>
> [ 26293.865] (EE) 9: /usr/bin/Xorg (_start+0x29) [0x423a19]<br>
> [ 26293.866] (EE) 10: ? (?+0x29) [0x29]<br>
> [ 26293.866] (EE)<br>
><br>
> Signed-off-by: Peter Hutterer <<a href="mailto:peter.hutterer@who-t.net">peter.hutterer@who-t.net</a>><br>
> ---<br>
>  dix/events.c | 3 ++-<br>
>  1 file changed, 2 insertions(+), 1 deletion(-)<br>
><br>
> diff --git a/dix/events.c b/dix/events.c<br>
> index 03b2d2e..ed3138d 100644<br>
> --- a/dix/events.c<br>
> +++ b/dix/events.c<br>
> @@ -1441,7 +1441,8 @@ UpdateTouchesForGrab(DeviceIntPtr mouse)<br>
>                  listener->type = LISTENER_POINTER_GRAB;<br>
>              else<br>
>                  listener->type = LISTENER_GRAB;<br>
> -            FreeGrab(listener->grab);<br>
> +            if (listener->grab)<br>
> +                FreeGrab(listener->grab);<br>
>              listener->grab = AllocGrab(grab);<br>
>          }<br>
>      }<br>
<br>
</div></div>free(NULL) works.<br>
IMHO this patch should go to FreeGrab() to be in line with other free() functions.<br>
Is there a special reason not to do this  ?<br>
<br>
re<br>
<span class="HOEnZb"><font color="#888888"> wh<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
<br>
_______________________________________________<br>
<a href="mailto:xorg-devel@lists.x.org">xorg-devel@lists.x.org</a>: X.Org development<br>
Archives: <a href="http://lists.x.org/archives/xorg-devel" target="_blank">http://lists.x.org/archives/xorg-devel</a><br>
Info: <a href="http://lists.x.org/mailman/listinfo/xorg-devel" target="_blank">http://lists.x.org/mailman/listinfo/xorg-devel</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>  Jasper<br>
</div>