perl-Gtk2 r2154 - in trunk: . t



Author: tsch
Date: Sun Mar  8 18:40:43 2009
New Revision: 2154
URL: http://svn.gnome.org/viewvc/perl-Gtk2?rev=2154&view=rev

Log:
* t/GtkHBox.t: Test that widgets packed into a box are completely freed upon
removal even if they previously appeared as a callback argument.  This is a
test for a recent memory leak fix in Glib.

* t/GtkTreeModelIface.t: The leak fix mentioned above causes this test to
correctly run FINALIZE_INSTANCE now, so adjust the test plan.


Modified:
   trunk/ChangeLog
   trunk/t/GtkHBox.t
   trunk/t/GtkTreeModelIface.t

Modified: trunk/t/GtkHBox.t
==============================================================================
--- trunk/t/GtkHBox.t	(original)
+++ trunk/t/GtkHBox.t	Sun Mar  8 18:40:43 2009
@@ -1,13 +1,32 @@
 #!/usr/bin/perl -w
 use strict;
-use Gtk2::TestHelper tests => 1, noinit => 1;
+use Gtk2::TestHelper tests => 3, noinit => 1;
 
 # $Id$
 
 my $box = Gtk2::HBox -> new();
 isa_ok($box, "Gtk2::HBox");
 
+{
+  my $label = Gtk2::Label->new ('hello');
+  $box->pack_start ($label, 0,0,0);
+  $box->remove($label);
+  require Scalar::Util;
+  Scalar::Util::weaken ($label);
+  is ($label, undef, 'child destroyed by weakening after being in box');
+}
+{
+  my $label = Gtk2::Label->new ('hello');
+  $box->pack_start ($label, 0,0,0);
+  $box->foreach (sub { });
+  $box->remove($label);
+  require Scalar::Util;
+  Scalar::Util::weaken ($label);
+  is ($label, undef,
+      'child destroyed by weakening after being in box -- and foreach()');
+}
+
 __END__
 
-Copyright (C) 2003 by the gtk2-perl team (see the file AUTHORS for the
+Copyright (C) 2003, 2009 by the gtk2-perl team (see the file AUTHORS for the
 full list).  See LICENSE for more information.

Modified: trunk/t/GtkTreeModelIface.t
==============================================================================
--- trunk/t/GtkTreeModelIface.t	(original)
+++ trunk/t/GtkTreeModelIface.t	Sun Mar  8 18:40:43 2009
@@ -346,7 +346,7 @@
 
 package main;
 
-use Gtk2::TestHelper tests => 179, noinit => 1;
+use Gtk2::TestHelper tests => 180, noinit => 1;
 use strict;
 use warnings;
 
@@ -456,6 +456,9 @@
 $model->sort(3);
 $model->sort(23);
 
+# This should result in a call to FINALIZE_INSTANCE
+$model = undef;
+
 # Exercise Gtk2::TreeIter->set.
 { my $myvar;
   my $stamp = 123;



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