perl-Gtk2 r2153 - in trunk: . t xs
- From: tsch svn gnome org
- To: svn-commits-list gnome org
- Subject: perl-Gtk2 r2153 - in trunk: . t xs
- Date: Sun, 8 Mar 2009 17:59:16 +0000 (UTC)
Author: tsch
Date: Sun Mar 8 17:59:16 2009
New Revision: 2153
URL: http://svn.gnome.org/viewvc/perl-Gtk2?rev=2153&view=rev
Log:
Take ownership of objects returned by gtk_tree_model_filter_new to avoid
leaking them. Patch by Kevin Ryde.
Modified:
trunk/ChangeLog
trunk/t/GtkTreeModelFilter.t
trunk/xs/GtkTreeModelFilter.xs
Modified: trunk/t/GtkTreeModelFilter.t
==============================================================================
--- trunk/t/GtkTreeModelFilter.t (original)
+++ trunk/t/GtkTreeModelFilter.t Sun Mar 8 17:59:16 2009
@@ -1,7 +1,7 @@
#!/usr/bin/perl -w
use strict;
use Gtk2::TestHelper
- tests => 26,
+ tests => 27,
noinit => 1,
at_least_version => [2, 4, 0, "GtkTreeModelFilter is new in 2.4"];
@@ -76,7 +76,14 @@
$filter -> set_visible_column(0);
+{
+ require Scalar::Util;
+ my $f = Gtk2::TreeModelFilter->new($list);
+ Scalar::Util::weaken($f);
+ is ($f, undef, 'destroyed by weakening');
+}
+
__END__
-Copyright (C) 2003-2005 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/xs/GtkTreeModelFilter.xs
==============================================================================
--- trunk/xs/GtkTreeModelFilter.xs (original)
+++ trunk/xs/GtkTreeModelFilter.xs Sun Mar 8 17:59:16 2009
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2005 by the gtk2-perl team (see the file AUTHORS for a
+ * Copyright (C) 2003-2009 by the gtk2-perl team (see the file AUTHORS for a
* full list)
*
* This library is free software; you can redistribute it and/or
@@ -66,9 +66,19 @@
gperl_prepend_isa ("Gtk2::TreeModelFilter", "Gtk2::TreeModel");
## GtkTreeModel *gtk_tree_model_filter_new (GtkTreeModel *child_model, GtkTreePath *root);
-GtkTreeModel *gtk_tree_model_filter_new (class, GtkTreeModel *child_model, GtkTreePath_ornull *root=NULL);
- C_ARGS:
- child_model, root
+ ##
+ ## Use GtkTreeModelFilter_noinc return to take ownership of the
+ ## reference on the returned object. (GtkTreeModel is only a
+ ## GInterface and the typemaps for it don't include a _noinc or _own
+ ## variant.)
+ ##
+GtkTreeModelFilter_noinc *
+gtk_tree_model_filter_new (class, GtkTreeModel *child_model, GtkTreePath_ornull *root=NULL);
+ CODE:
+ RETVAL = (GtkTreeModelFilter *)
+ gtk_tree_model_filter_new(child_model, root);
+ OUTPUT:
+ RETVAL
## void gtk_tree_model_filter_set_visible_func (GtkTreeModelFilter *filter, GtkTreeModelFilterVisibleFunc func, gpointer data, GtkDestroyNotify destroy);
void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]