Re: calling a procedure in a plugin

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

 



On 10/19/07, Giuseppe Pasquino <giuseppepasquino@xxxxxxxxxxx> 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@xxxxxxxxxxxxxxxxxxxxxx
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer

[Index of Archives]     [Video For Linux]     [Photo]     [Yosemite News]     [gtk]     [GIMP for Windows]     [KDE]     [GEGL]     [Gimp's Home]     [Gimp on GUI]     [Gimp on Windows]     [Steve's Art]

  Powered by Linux