[PATCH 2/6] exa: increase/rework safety checks in Prepare/FinishAccess.
Michel Dänzer
michel at daenzer.net
Tue Mar 3 23:25:46 PST 2009
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