Re: Problems with un-owned objects passed to closures in pygobject (gtk_cell_renderer_text_start_editing)



On Tue, 2013-02-05 at 05:33 -0800, Simon Feltman wrote:
> For completeness, the two major problems are as follows:
> 
> 
> https://bugzilla.gnome.org/show_bug.cgi?id=687522
> This is a vfunc implementation which the gtk internals are basically
> expecting a floating ref from. Using the standard scheme just listed,
> we sink and own the created MenuToolButton. The held widget is then
> finalized at the end of the vfunc, returning an invalid object back to
> the caller. If we add an extra ref we get a leak because the method is
> marked as transfer-none. 

Giovanni's diagnosis sounds right to me; it's pretty unfortunate that
there's a transient state where the object is unreferenced.   Besides
the timeout approach, you could also use a thread?  But I guess that's
also racy since there's a window in which the python mutex is not held,
but the native code has not yet added a ref.

Possibly an approach where on (transfer full) input parameters, and
we're recursing (i.e. we have a chain of python -> native -> python),
defer the unrefs until the next outermost python is reentered.





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