Re: Glib 1.102 (stable)

On Thu, Dec 15, 2005 at 10:24:53AM -0500, muppet wrote:

On Dec 15, 2005, at 8:53 AM, Sean Dague wrote:

On Mon, Nov 28, 2005 at 09:49:31PM +0100, Torsten Schoenfeld wrote:
On Mon, 2005-11-28 at 21:48 +0100, Torsten Schoenfeld wrote: 

This should read 

of course.

I'm getting a lot of users of perl-Glib 1.102 reporting segfaults  
works fine for them.)  The following is the backtrace I've managed  
to gather
from one of the users:

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 code in question is actually a derived version of
Gtk2::CellRendererPixText to use stock icons (the code is inline at the end
of the email.)

The property name should be ASCII, but the value could be UTF8.  The
CellRender is used in a buddy list, and with the possibility of names that
are UTF8.

This could be one of two things --- an invalid property name in the  
attribute setup for your treeview, or memory corruption.

Have you been able to reproduce the crash with a subset of your  
code?  At this point, code will be the most helpful thing you can  

#!/usr/bin/perl -w

# This was taken from a posting on the gtk2-perl mailing list by
# Florian Schaefer <listbox netego de> and patched with the fixes
# subsequently posted by muppet <scott asofyet org>.
# Great stuff!
# I probably added a load of bugs when I modified it to use stock icons.

package Gtk2::CellRendererPixText;

use strict;
use warnings;
use Gtk2;
use Glib::Object::Subclass
    properties => [
                   Glib::ParamSpec->string ('stock_id',
                                            'The stock image to display',
                                            "", G_PARAM_READWRITE),
                   Glib::ParamSpec->string ('text',
                                            'The text string to display',
                                            "", G_PARAM_READWRITE),

  my $self = shift;

sub setup_text {
  my ($self, $widget) = @_;
  my $layout = $widget->create_pango_layout ($self->{'text'});
  return ($layout->get_pixel_size, $layout);

sub GET_SIZE {
  my ($cell, $widget, $cell_area) = @_;
  my ($x_offset, $y_offset) = (0, 0);

  my ($width, $height) = $cell->setup_text($widget);

  my $stock_id = $cell->{stock_id};
  if ($stock_id) {
    my $pixbuf = $cell->{pixbuf} = $widget->render_icon($stock_id, 'menu');
    my $pw = $pixbuf->get_width;
    my $ph = $pixbuf->get_height;
    $width += $pw;
    $height = $ph if $ph > $height;
  } else {
    delete $cell->{pixbuf};

  return ($x_offset, $y_offset, $width, $height);

sub RENDER {
  my ($cell, $window, $widget, $background_area,
      $cell_area, $expose_area, $flags) = @_;

  my $pw = 0;
  my $stock_id = $cell->{stock_id};
  if ($stock_id) {
    my $pixbuf = $cell->{pixbuf} = $widget->render_icon($stock_id, 'menu');
    $pw = $pixbuf->get_width;
    my $ph = $pixbuf->get_height;

                         $cell_area->y() + int(($cell_area->height -
                         $pw, $ph,
                         "GDK_RGB_DITHER_NONE", 0, 0

  my ($width, $height, $layout) = $cell->setup_text ($widget);

                                   $cell_area->x + $pw + 1,
                                   $cell_area->y + ($cell_area->height -
                                                    $height) / 2,




Sean Dague                                       Mid-Hudson Valley
sean at dague dot net                            Linux Users Group                       

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

Attachment: pgpZ2erEMJRO9.pgp
Description: PGP signature

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