Re: new gtk2-perl



Although on my first attempt a "make test" in the Gtk2/ directory of  your
tarball reported a lot of errors (beside other things it tries to  allocate
4294967276 bytes of memory ;) : I think this is the right way  (I'll do some
in-depth debugging on what's going wrong here later).

the memory thing is a known error, on all systems thus far, i put that test in
there to specifically exercise it so that we'll have a reliable what to check
that it's fixed when it is. everything else (at least on the systems i've had
access to) is just debugging information rather than errors, if you are
getting actual error's please send a copy of them to myself and/or muppet and
we'll look at them.

from what i can tell the bug is in the c level GtkGammaCurve (or GtkCurve). 

it looks like an uninitialized value in something about the gamma curve 
(or curve) object before it's shown.

********* this order works fine **********************************
$win = Gtk2::Window->new("toplevel");
my $gamma = Gtk2::GammaCurve->new();
$gamma->show;
$win->add($gamma);
$win->show_all;
$gamma->curve->set_range(0, 255, 0, 255);
$gamma->curve->set_vector(0, 255, 127, 255, 127, 0);
$gamma->curve->set_curve_type('spline');

********* this order exhibits the segfault ***********************
$win = Gtk2::Window->new("toplevel");
my $gamma = Gtk2::GammaCurve->new();
$gamma->curve->set_range(0, 255, 0, 255);
$gamma->curve->set_vector(0, 255, 127, 255, 127, 0);
$gamma->curve->set_curve_type('spline'); # causes a gmem alloc error
$gamma->show;
$win->add($gamma);
$win->show_all;

as you can see running the curve manip stuff before it has been added 
to the window seems to cause the problem.

further evidence... 

changing the code for the affected function to the following:

## void gtk_curve_set_curve_type (GtkCurve *curve, GtkCurveType type) 
void
gtk_curve_set_curve_type (curve, type)
        GtkCurve     * curve
        GtkCurveType   type
    CODE:
        fprintf(stderr, "curve: %X, type: %d\n", curve, type);
        gtk_curve_set_curve_type(curve, type);

gives this output:

perl bug.pl
...
curve: 81B3AD0, type: 1

GLib-ERROR **: gmem.c:141: failed to allocate 4294967276 bytes


as you can see the last thing i have the wrapper do before it calls the 
c function (i.e. goes into gtk2's c code) is to print out the value that 
"spline" got mapped to which is the correct value of 1 (type). the other
possibility is that the GtkCurve * curve is invalid. i don't think this 
is the case as curve's value is the same when the working code above is 
used 'curve: 81B3AD0, type: 1'

man, i can't say anything short.

-rm




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