Re: GtkGC shared auto-release



muppet <scott asofyet org> writes:

If you're going to  
release the GC for other code to use, you're going to lose your last  
reference to it (which is why it has to be done with DESTROY ---  
FINALIZE_INSTANCE won't be called until after DESTROY), so why should  
you have to call an explicit release?

Probably no good reason really, except in C code that's what you do and
the "GtkGC*" pointer returned out of the pool is indistinguishable from
an ordinary "GtkGC*" (so far as I know).

Should we just add this DESTROY override to the bindings?  (Taking  
care to retain compatibility with code that calls ->release  
explicitly, of course.)

It seems silly to have such a small external sugar module to fix  
something like this...

My code below, in case it provides inspiration.

I guess even darker magic than usual may be needed if selected Gtk2::GC
objects have to remember to call gtk_gc_release one or more times when
no longer wanted from perl.

Attachment: GtkGCobj.pm
Description: Text Data



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