Bug#545616: FTBFS of libgtk2-perl because of call of to_string() on undefined method

Daniel Leidert daniel.leidert at wgdd.de
Fri Sep 18 23:17:50 UTC 2009


tags 545616 + patch
thanks

Hi,

Attached is a patch for t/GtkTreeView.t to fix the FTBFS (with many
thanks to Kristian Rietveld). Quoting himself for the background:

> > (<unknown>:20960): Gtk-CRITICAL **: gtk_tree_path_to_string: assertion `path != NULL' failed
> > path=(null)
> >
> > Am I still doing something wrong?
> 
> Setting the cursor still fails because path "1:0" is not visible in
> the tree view (although the path does exist in the model).  It is not
> visible in the tree view because node "1" is collapsed.  If you expand
> node "1" first, then the call to gtk_tree_view_set_cursor() will
> succeed as well as the call to gtk_tree_view_get_cursor().
> 
> > The problem I'm trying to reproduce is the testcase from
> > http://git.gnome.org/cgit/perl-Gtk2/tree/t/GtkTreeView.t. This one fails
> > in line 233 (->to_string()) on recent Debian system, because it seems
> > the path returned is NULL. So I'm trying to program this in C to check,
> > if the result is the same. And it seems to be the case.
> 
> The reason why this is failing now is probably because there have been
> some changes in this area in trunk recently, making the behavior more
> strict.

The solution is as simple as calling e.g. $view->expand_all() before
setting the cursor. This can be more fine-grained in the official
test-suite. IMO you should forward this issue.

Regards, Daniel
-------------- next part --------------
Expand the GtkTreeView. Otherwise set_cursor() will fail, making get_cursor()
return NULL, making to_string() error out with

Can't call method "to_string" on an undefined value at t/GtkTreeView.t line 233.

--- a/t/GtkTreeView.t
+++ b/t/GtkTreeView.t
@@ -229,6 +229,7 @@
 isa_ok($view -> get_background_area(undef, $view_column_two), "Gtk2::Gdk::Rectangle");
 isa_ok($view -> get_background_area($path, undef), "Gtk2::Gdk::Rectangle");
 
+$view -> expand_all();
 $view -> set_cursor(Gtk2::TreePath -> new("1:0"), $view_column_one, 0);
 is(($view -> get_cursor()[0]->to_string()), "1:0");
 is(($view -> get_cursor())[1], $view_column_one);
@@ -614,6 +615,7 @@
 	skip("set_cursor_on_cell is new in 2.2.x", 2)
 		unless Gtk2->CHECK_VERSION (2, 2, 0);
 
+	$view -> expand_all();
 	$view -> set_cursor_on_cell(Gtk2::TreePath -> new("1:1"),
 				    $view_column,
 				    $cell_renderer,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Dies ist ein digital signierter Nachrichtenteil
URL: <http://lists.alioth.debian.org/pipermail/pkg-perl-maintainers/attachments/20090919/34df076c/attachment-0001.pgp>


More information about the pkg-perl-maintainers mailing list