[Cairo] cairo_restore leaves cairo_t in invalid state with status 0

Keith Packard keithp at keithp.com
Sat Sep 13 23:45:02 PDT 2003


Call cairo_restore without ever calling cairo_save and you pop the gstate 
off the list, leaving it NULL.  Try to invoke any cairo function that uses 
gstate and you get a segfault.

Suggest

cairo_restore () {
	if (cairo->status) return;
	cairo->gstate = cairo->gstate->next;
	if (!cairo->gstate)
		cairo->status = CAIRO_STATUS_INVALID_RESTORE;
}

Questions?

-keith






More information about the cairo mailing list