On Wed, 2008-04-23 at 19:50 +0200, Dirk Meyer wrote:
> Hi,
> 
> when using the cairo bindings from pyclutter my application
> segfaults. I get a segfault as soon as I want to get the cairo context
> using get_context. The C examples in the clutter-cairo package work,
> so it looks like it is a bug in the Python bindings. I use the latest
> versions of clutter, clutter-cairo and pyclutter.

yep, I noticed a segfault as well after the 0.6.1 release of
clutter-cairo - I'm investigating it right now.

> Looking at the cairo bindings code, I'm kind of confused. The
> auto-generated cluttercairo.c has a function _wrap_clutter_cairo_new
> that does NOT call clutter_cairo_new new at all

yep, that is the intended behaviour. the python bindings will construct
the GObject passing the constructor properties 'surface-width' and
'surface-height'. you won't see clutter_*_new() calls in pyclutter
unless you override the pygobject construction mechanism with your own
code - which is discouraged, unless the constructor performs something
else than g_object_new() - which is, in turn, discouraged.

>  and the size is all wrong. Example:

> | texture = clutter.cluttercairo.CairoTexture(100, 100)
> | print texture.get_size()            # returns 0,0 ????
> | context = texture.cairo_create()    # segfault
> 
> Maybe I'm doing something wrong here.

yes, you're doing something wrong. :-)

the size you're passing to the CairoTexture constructor is the actual
size of the cairo surface, not the size of the actor. the size of the
actor is decided using the set_size() method - which will change the
size of the texture.

you might want a 300x200 surface spread on a 640x480 texture, or a
800x600 surface scaled down to 400x300. that's why the constructor
parameters are called 'surface-width' and 'surface-height' and not
'width' and 'height'.

ciao,
 Emmanuele.

-- 
Emmanuele Bassi, OpenedHand Ltd.
Unit R, Homesdale Business Centre
216-218 Homesdale Rd., Bromley - BR12QZ
http://www.o-hand.com

-- 
To unsubscribe send a mail to [EMAIL PROTECTED]

Reply via email to