Re: GtkGC shared auto-release
- From: Kevin Ryde <user42 zip com au>
- To: gtk2-perl List <gtk-perl-list gnome org>
- Subject: Re: GtkGC shared auto-release
- Date: Wed, 16 Jan 2008 07:57:21 +1100
muppet <scott asofyet org> writes:
This is not easy to test. GCs are GObjects, not GtkObjects, so we
don't get a "destroy" signal.
Though the hairy lifespan linkage between the sv and the object is a
GObject level thingie is it? Something like below was what I was
thinking of, if it's meant to work.
before release: defined
after release: not defined
Incidentally, I was wondering if the keys in the hash which gives the
GCValues could be checked (like "line_width" below). It looks like
anything unknown is ignored, making it a bit easy for typos to go
unnoticed.
use Gtk2 '-init';
use strict;
use warnings;
use Scalar::Util;
my $colormap = Gtk2::Gdk::Colormap->new (Gtk2::Gdk::Visual->get_best, 0);
my $gc = Gtk2::GC->get (8, $colormap, {line_width=>123});
Scalar::Util::weaken ($gc);
print "before release: ", defined $gc ? "defined\n" : "not defined\n";
Gtk2::GC->release ($gc);
print "after release: ", defined $gc ? "defined\n" : "not defined\n";
exit 0;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]