Re: Bug in CellRenderText?



Matthias Bläsing said:
===snip===
$renderer = Gtk2::CellRendererText->new;
$column = Gtk2::TreeViewColumn->new_with_attributes ("Kommentar",
$renderer, text => 4);
print Dumper($renderer->get_property('attributes')); # Line 209
$treeview->append_column ($column);
===snap===

I get the following error:

NULL pointer made it into gperl_new_boxed at ./gallery.pl line 209.

It isn't perl'isch to do that ... ;-)

verified that this is true and that it's not his fault. there's a croak around
line 295 of GBoxed.xs.

changing the code to the following seems to straighten things out and provide
a correct behavior so far as i can tell:

        if (!boxed)
        {
#ifdef NOISY
                warn ("NULL pointer made it into gperl_new_boxed");
#endif
                return &PL_sv_undef;
        }

it's exercised any time you try to fetch a gobject's property (like
'attributes' on a CellRendererText) that is a  valid key, but has no value
set. (that's what seems to be the case where i'm testing it.)

the warning i silenced yesterday is now wrapped in #ifdef NOISY instead of #if
0. i would think that all of the warns in #ifdef NOISY's would be better off
as carp's so that they'd tell the user where the code that screwed things up
was even if it wasn't their fault, but that's just me and i could easily be
wrong. the message that was received here was from a croak so it did give the
perl line, and that probably made it a lot easier for matthias to locate the
offending code and send something out that would help to find the problem.

i'll commit the above change, if there's something wrong with it, it can
always be backed out or modified to be correct, i'm by no means an expert with
what is going on at the low levels of the Glib module.

-rm



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