[PATCH 2/6] exa: increase/rework safety checks in Prepare/FinishAccess.

Maarten Maathuis madman2003 at gmail.com
Wed Mar 4 03:06:23 PST 2009


Asserts are trapped by gdb, FatalErrors aren't. This is somewhat nice
when debugging.

Maarten.

On Wed, Mar 4, 2009 at 8:25 AM, Michel Dänzer <michel at daenzer.net> wrote:
> On Die, 2009-03-03 at 22:29 +0100, Maarten Maathuis wrote:
>>
>> +    if (pExaPixmap == NULL) {
>> +#ifdef DEBUG
>> +     FatalError("EXA bug: ExaDoPrepareAccess was called on a non-exa pixmap.\n");
>> +#else
>> +     ErrorF("EXA bug: ExaDoPrepareAccess was called on a non-exa pixmap.\n");
>> +     return FALSE;
>> +#endif
>
> Maybe you could use a macro to handle FatalError vs. ErrorF, to avoid
> cluttering up a lot of places like this.
>
>
>> +         ErrorF("EXA bug: pPixmap->devPrivate.ptr was %p, but should have been NULL.\n",
>> +             pPixmap->devPrivate.ptr);
>> +#ifdef DEBUG
>> +         assert(pPixmap->devPrivate.ptr == NULL);
>> +#endif
>
> Then you could also use the above to eliminate the remaining assert()s.
> In addition to what I mentioned on this before, FatalError() is
> generally a much more graceful failure mode than assert(), as it shuts
> down the X server as cleanly as possible, rather than the X server
> process dying instantly.
>
>
> If you fix this, your last set of patches looks good to me.
>
>
> --
> Earthling Michel Dänzer           |                http://www.vmware.com
> Libre software enthusiast         |          Debian, X and DRI developer
>


More information about the xorg-devel mailing list