Re: PangAttrShape destroy func firing unexepctedly

On 09/08/10 01:50, Travis Griggs wrote:
> Something weird happens. aDestroyFunc happens sometime after I do the
> show_layout. Which is weird (and currently undesirable) to me.

You seem to pass null as your copy-func to pango_attr_shape_new_with_data().
Having no copy-func but a destroy-func is sign of you doing something in your
destroy func that you are not supposed to do!

In this case, given your earlier explanations of what you are doing, I think
you need to implement aCopyFunc that increases refcount on your block /
mapping, and only destroy when refcount drops down to zero.

Think of it in this way:  Pango is free to split your shape attribute into two
(for example if other attributes partially intersect it), in which case it
will call your copy func to create a copy of the userdata (which will be
destroyed separately).  You may get multiple destroy calls, which is confusing
your code, but you can avoid the confusion by opting in to get copy notifications.

Hope that helps,

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]