Re: misc. cairo_t questions

Andrea Canciani <[email protected]>
Newsgroups gmane.comp.lib.cairo
Message-ID <CAN_5=BDL7xHE9UXK_rL8_5tZ1gVooXF0Z6CaxdzouizYc7hfwA@mail.gmail.com>
On Thu, Apr 12, 2012 at 10:00 PM, Roger Davis <[email protected]> wrote:
> Hi Uri,
>
> Thanks for your help! One followup question:
>
>
>>> (3) It seems like almost all of the cairo_set...(), etc., functions
>>> return void. Is there a standard behavior in place to handle bad arguments
>>> to these calls, or other error conditions?
>>
>>
>> Yes. If some object gets in an error condition, this error condition is
>> sticky. You can not un-error something afterwards. To get this error flag,
>> there are cairo_status(), cairo_surface_status(), cairo_pattern_status(),
>> ....
>
>
> I like to be reasonably rigorous in error checking (and am extremely averse
> to allowing situations that could result in a core dump), but it does seem
> like overkill to do a cairo_status() after every single change to a context
> or after every drawing operation. Are there certain operations to contexts
> or surfaces in particular which are unusually prone to error generation,
> especially errors which might ultimately lead to a core dump, which it would
> be useful to check via cairo_???_status()? By the way, checking status after
> cairo_select_font_face(cr, "NonexistentFont" ...) doesn't yield any abnormal
> error code, so I'm wondering when these functions might actually return
> useful information. Perhaps this particular case is non-representative since
> it is, as you say, from the toy API.

The API is designed so that as soon as an object gets into an error
status, it will never change anymore.
It will just ignore any operation, so operations on an error object
should never cause core dumps or misbehaviors.
From this point of view, you can check the status of an object at any
time, even after you're done with all of your operations and you
should be safe (but you might be unable to find out what specific
operation triggered the error).

Andrea

>
> Thanks!
>
> Roger
>
> --
> cairo mailing list
> [email protected]
> http://lists.cairographics.org/mailman/listinfo/cairo
--
cairo mailing list
[email protected]
http://lists.cairographics.org/mailman/listinfo/cairo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.