Re: Glib 1.102 (stable)



On Thu, Dec 15, 2005 at 10:44:42AM -0500, Sean Dague wrote:
<snip>
This looks like you have a perl-derived CellRenderer in your code.   
In frame #5, gtk_tree_view_column_cell_set_cell_data() is calling  
g_object_set_property() on something, most likely using an attribute  
set up when the TreeViewColumn was created.

The first red flag is the value of property_name in frame #4 -- is  
that a garbage string or a unicode string?  I believe that most of  
the code assumes property names will be ASCII.  This questionable  
value appears to have been mapped to a decent property id for the  
call to gperl_type_set_property(), which is in the vtable for perl- 
derived GObjects.  When gperl_type_set_property() discovers there is  
no SET_PROPERTY() in the package and no sub registered as a set  
handler, it falls back to setting a key in the wrapper hash with the  
same name as the property.  However, as you see in the trace, the  
name in frame #2 does not match the property_name in frame #4.

The following program was provided by one of our users that demonstrates the
glib crash we're seeing.  Hopefully this will help figure out if there is a
bug in glib, or a bug in our brains, and we should be doing something
different.


#!/usr/bin/perl -w

# With Glib Perl v1.101 this script does not crash, but with v1.102
# it does.  Removing the lines with BUG fixes the problem.  Sadly
# fixing it tends to be more difficult in practice.
#
# On 1.102 I get:
#
#   bash$ perl crash.pl 
#   INIT_INSTANCE
#   Segmentation fault (core dumped)
#   bash$ fgrep -v BUG crash.pl >work.pl 
#   bash$ perl work.pl  
#   INIT_INSTANCE
#   Success made it to GET_SIZE
#

package CrashTest::CellRenderer;
use strict;
use Glib qw(G_PARAM_READWRITE);
use Gtk2;
use Glib::Object::Subclass "Gtk2::CellRenderer",
  properties => [ Glib::ParamSpec->string('text', 'Text',
                                          'The text string to display', '',
                                          G_PARAM_READWRITE) ];

sub INIT_INSTANCE { warn "INIT_INSTANCE\n"; }
sub GET_SIZE { die "Made it to GET_SIZE\n"; }
sub RENDER { die "Made it to RENDER\n"; }

package main;
use strict;
use Glib;
use Gtk2 -init;

my $window = Gtk2::Window->new;
my $view;
{ # BUG: remove these brackets and it works!
  my $treestore = Gtk2::TreeStore->new(qw/Glib::String/);
  my $iter = $treestore->append(undef);
  $treestore->set($iter, 0, "Row 1",);
  $view = Gtk2::TreeView->new($treestore);
  my $renderer = CrashTest::CellRenderer->new;
  my $col =
    Gtk2::TreeViewColumn->new_with_attributes("Simple text",
                                              $renderer,
                                              "text" => 0);
  $view->append_column($col);
} # BUG: remove these brackets and it works!
$window->add ($view);
$window->show_all;
Gtk2->main;




-- 
__________________________________________________________________

Sean Dague                                       Mid-Hudson Valley
sean at dague dot net                            Linux Users Group
http://dague.net                                 http://mhvlug.org

There is no silver bullet.  Plus, werewolves make better neighbors
than zombies, and they tend to keep the vampire population down.
__________________________________________________________________

Attachment: pgpVIZ56HwIaN.pgp
Description: PGP signature



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