Re: GtkGC shared auto-release
- From: muppet <scott asofyet org>
- To: gtk2-perl List <gtk-perl-list gnome org>
- Subject: Re: GtkGC shared auto-release
- Date: Mon, 14 Jan 2008 23:55:03 -0500
On Jan 14, 2008, at 7:59 PM, Kevin Ryde wrote:
Torsten Schoenfeld <kaffeetisch gmx de> writes:
+ my $two = Gtk2::GC -> get(32, $colormap, $values);
+ Gtk2::GC -> get(32, $colormap, $values);
+ Gtk2::GC -> get(32, $colormap, $values);
+ # Gtk2::GC -> release($two) should now be called three times,
but how do we
+ # verify that?
+}
Too few releases should leave the pool with a ref on the GC, so
perhaps
keep only a weakened copy of the GC and check that goes undef when the
pool lets go.
This is not easy to test. GCs are GObjects, not GtkObjects, so we
don't get a "destroy" signal. You need g_object_weak_ref() to get
destruction notifications on plain GObjects. Unfortunately, Glib does
not bind the weakref stuff for technical reasons (how do you map
between the scalar and the GObject without creating a potential
crash?), and from what i can tell, stuff like Devel::WeakRef and
Test::Weaken is not part of the perl core. That would make the
testing a little difficult.
I did, however, use g_object_weak_ref() in my XS code, with a callback
that simply prints the dead pointer value, to verify that the GC
objects do, in fact, go away at the right time.
Some quick experiments with using a normal perl object, stored in the
Gtk2::GC's wrapper hash, as a destroy notifier were frustrating, as
the objects seemed to live too long.
--
So this new album took us quite a while, to get it together, to find a
title and things like that - and we were travelling quite a bit - we
made a few sort of gestures in the East, and a few gestures in the
West, and then we got thrown out because of our gestures - this is
something that we decided was an apt title for a thing that's called
'The Song Remains The Same'.
-- Robert Plant, rambling to introduce a song
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]