[Gimp-developer] calling a procedure in a plugin
David Gowers
00ai99 at gmail.com
Fri Oct 19 02:27:48 PDT 2007
On 10/19/07, Giuseppe Pasquino <giuseppepasquino at hotmail.com> 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);
More information about the Gimp-developer
mailing list