[cairo] ASSERT_NOT_REACHED

Radek Doulík rodo at novell.com
Tue Jul 19 07:47:38 PDT 2005


On Tue, 2005-07-19 at 10:35 -0400, Carl Worth wrote:
> On Tue, 19 Jul 2005 07:29:46 -0700, Radek Doulík wrote:
> > As Carl suggested on irc, some code was using cairo_format_t at place
> > where cairo_content_t was expected (API changed lately).
> 
> Yes, but there's still something wrong. An application error, (such as
> passing a cairo_format_t instead of a cairo_content_t), should never
> cause an assertion. The assertion triggering is intended to indicate
> that there is some internal error within cairo itself.
> 
> For example, in the case of cairo_surface_create_similar, the
> CAIRO_CONTENT_VALID check should trigger before it ever gets the
> chance to get to the assertion.

Looks like CAIRO_CONTENT_VALID check doesn't work as
cairo_surface_create_similar is exactly how I got it.

==24367==    by 0x1CFC8929: __GI___assert_fail (assert.c:83)
==24367==    by 0x261E2259: _cairo_format_from_content (cairo-image-surface.c:279)
==24367==    by 0x261E7940: _cairo_surface_create_similar_solid (cairo-surface.c:115)
==24367==    by 0x261E79E4: cairo_surface_create_similar (cairo-surface.c:101)

#define CAIRO_CONTENT_VALID(content) (((content) & ~(CAIRO_CONTENT_COLOR | \
						     CAIRO_CONTENT_ALPHA | \
						     CAIRO_CONTENT_COLOR_ALPHA)) == 0)

That check will succeed in case zero content (CAIRO_FORMAT_ARGB32) is
passed, which seems wrong.

Cheers
Radek





More information about the cairo mailing list