On 10/19/07, Giuseppe Pasquino <[EMAIL PROTECTED]> wrote:
>
> I have modified the code as you suggested:
>
>         GimpRGB *colore;
>         GimpChannelOps parametri;
>         gboolean success;
>         gimp_rgb_set_uchar(colore, pixel[0], pixel[1], pixel[2]);
>         parametri = GIMP_CHANNEL_OP_REPLACE;
>         success = gimp_by_color_select(drawable->drawable_id,
>                                                        colore,
>                                                        termogramma.scarto,
>                                                        parametri,
>                                                        FALSE,
>                                                        FALSE,
>                                                        0.0,
>                                                        FALSE);
>
> The compiler returns me no error but when I execute the gimp return a fatal 
> error: "segmentation fault". I think the problem is in one of this line but, 
> with my few experience, I can't find it...

You are attempting to modify a color at some random memory location,
that's never been allocated (you didn't initialize colore) -- and then
you passed this dodgy pointer to gimp_by_color_select.

In most parts of the GIMP, GimpRGB are statically allocated, and you
see that they are used more like this:


         GimpRGB colore;
         GimpChannelOps parametri;
         gboolean success;
         gimp_rgb_set_uchar(&colore, pixel[0], pixel[1], pixel[2]);
         parametri = GIMP_CHANNEL_OP_REPLACE;
         success = gimp_by_color_select(drawable->drawable_id,
                                                        &colore,
                                                        termogramma.scarto,
                                                        parametri,
                                                        FALSE,
                                                        FALSE,
                                                        0.0,
                                                        FALSE);
_______________________________________________
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer

Reply via email to