applied gimp-lecorfec-99041[02]-0, changes follow

* applied gimp-lecorfec-99041[02]-0, changes follow

* plug-ins/FractalExplorer/Dialogs.h (make_color_map):
replaced free with g_free to fix segfault.

* plug-ins/Lighting/lighting_preview.c (compute_preview):
allocate xpostab and ypostab only when needed (it could also be
allocated on stack with a compilation-fixed size like MapObject).
It avoids to lose some Kb on each preview :)
Also reindented (unfortunate C-c C-q) some other lines.

* plug-ins/Lighting/lighting_main.c (run):
release allocated postabs.

* plug-ins/Lighting/lighting_ui.c:
callbacks now have only one argument because gck widget use
gtk_signal_connect_object. Caused segfault for scale widget.

* plug-ins/autocrop/autocrop.c (doit):
return if image has only background (thus fixing a segfault).

* plug-ins/emboss/emboss.c (pluginCore, emboss_do_preview):
replaced malloc/free with g_malloc/g_free (unneeded, but
shouldn't everyone use glib calls ? :)

* plug-ins/flame/flame.c :
replaced a segfaulting free, and several harmless malloc/free pairs.

* plug-ins/flame/megawidget.c (mw_preview_build):
replaced harmless malloc/free pair.
Note : mwp->bits is malloc'ed but seems to be never freed.

* plug-ins/fractaltrace/fractaltrace.c (pixels_free):
replaced a bunch of segfaulting free.
(pixels_get, dialog_show): replaced gtk_signal_connect_object
with gtk_signal_connect to accomodate callbacks (caused STRANGE
dialog behaviour, coz you destroyed buttons one by one).

* plug-ins/illusion/illusion.c (dialog):
same gtk_signal_connect_object replacement for same reasons.

* plug-ins/libgck/gck/gckcolor.c :
changed all gck_rgb_to_color* functions to use a static GdkColor
instead of a malloc'ed area. Provided reentrant functions with
the old behaviour (gck_rgb_to_color*_r). Made some private functions
static, too.
gck_rgb_to_gdkcolor now use the new functions while
gck_rgb_to_gdkcolor_r is the reentrant version.
Also affected by this change: gck_gc_set_foreground and
gck_gc_set_background (no more free(color)).

* plug-ins/libgck/gck/gckcolor.h :
added the gck_rgb_to_gdkcolor_r proto.

* plug-ins/lic/lic.c (ok_button_clicked, cancel_button_clicked) :
segfault on gtk_widget_destroy, now calls gtk_main_quit.
(dialog_destroy) : segfault on window closure when called by
"destroy" event. Now called by "delete_event".

* plug-ins/megawidget/megawidget.c (mw_preview_build):
replaced harmless malloc/free pair.
Note : mwp->bits is malloc'ed but seems to be never freed.

* plug-ins/png/png.c (load_image):
replaced 2 segfaulting free.

* plug-ins/print/print-ps.c (ps_print):
replaced a segfaulting free (called many times :).

* plug-ins/sgi/sgi.c (load_image, save_image):
replaced a bunch of segfaulting free, and did some harmless
inits to avoid a few gcc warnings.

* plug-ins/wind/wind.c (render_wind):
replaced a segfaulting free.
(render_blast): replaced harmless malloc/free pair.

* plug-ins/bmp/bmpread.c (ReadImage):
yet another free()/g_free() problem fixed.

* plug-ins/exchange/exchange.c (real_exchange):
ditto.

* plug-ins/fp/fp.h: added Frames_Check_Button_In_A_Box proto.
* plug-ins/fp/fp_gtk.c: closing subdialogs via window manager
wasn't handled, thus leading to errors and crashes.
Now delete_event signals the dialog control button
to close a dialog with the good way.

* plug-ins/ifscompose/ifscompose.c (value_pair_create):
tried to set events mask on scale widget (a NO_WINDOW widget).

* plug-ins/png/png.c (save_image):
Replaced 2 free() with g_free() for g_malloc'ed memory.
Mysteriously I corrected the loading bug but not the saving one :)

-Yosh
This commit is contained in:
Manish Singh 1999-04-15 21:49:09 +00:00
parent 6f386957f5
commit 141b6e8a25
35 changed files with 1010 additions and 245 deletions

View File

@ -1,3 +1,101 @@
Thu Apr 15 14:41:01 PDT 1999 Manish Singh <yosh@gimp.org>
* applied gimp-lecorfec-99041[02]-0, changes follow
* plug-ins/FractalExplorer/Dialogs.h (make_color_map):
replaced free with g_free to fix segfault.
* plug-ins/Lighting/lighting_preview.c (compute_preview):
allocate xpostab and ypostab only when needed (it could also be
allocated on stack with a compilation-fixed size like MapObject).
It avoids to lose some Kb on each preview :)
Also reindented (unfortunate C-c C-q) some other lines.
* plug-ins/Lighting/lighting_main.c (run):
release allocated postabs.
* plug-ins/Lighting/lighting_ui.c:
callbacks now have only one argument because gck widget use
gtk_signal_connect_object. Caused segfault for scale widget.
* plug-ins/autocrop/autocrop.c (doit):
return if image has only background (thus fixing a segfault).
* plug-ins/emboss/emboss.c (pluginCore, emboss_do_preview):
replaced malloc/free with g_malloc/g_free (unneeded, but
shouldn't everyone use glib calls ? :)
* plug-ins/flame/flame.c :
replaced a segfaulting free, and several harmless malloc/free pairs.
* plug-ins/flame/megawidget.c (mw_preview_build):
replaced harmless malloc/free pair.
Note : mwp->bits is malloc'ed but seems to be never freed.
* plug-ins/fractaltrace/fractaltrace.c (pixels_free):
replaced a bunch of segfaulting free.
(pixels_get, dialog_show): replaced gtk_signal_connect_object
with gtk_signal_connect to accomodate callbacks (caused STRANGE
dialog behaviour, coz you destroyed buttons one by one).
* plug-ins/illusion/illusion.c (dialog):
same gtk_signal_connect_object replacement for same reasons.
* plug-ins/libgck/gck/gckcolor.c :
changed all gck_rgb_to_color* functions to use a static GdkColor
instead of a malloc'ed area. Provided reentrant functions with
the old behaviour (gck_rgb_to_color*_r). Made some private functions
static, too.
gck_rgb_to_gdkcolor now use the new functions while
gck_rgb_to_gdkcolor_r is the reentrant version.
Also affected by this change: gck_gc_set_foreground and
gck_gc_set_background (no more free(color)).
* plug-ins/libgck/gck/gckcolor.h :
added the gck_rgb_to_gdkcolor_r proto.
* plug-ins/lic/lic.c (ok_button_clicked, cancel_button_clicked) :
segfault on gtk_widget_destroy, now calls gtk_main_quit.
(dialog_destroy) : segfault on window closure when called by
"destroy" event. Now called by "delete_event".
* plug-ins/megawidget/megawidget.c (mw_preview_build):
replaced harmless malloc/free pair.
Note : mwp->bits is malloc'ed but seems to be never freed.
* plug-ins/png/png.c (load_image):
replaced 2 segfaulting free.
* plug-ins/print/print-ps.c (ps_print):
replaced a segfaulting free (called many times :).
* plug-ins/sgi/sgi.c (load_image, save_image):
replaced a bunch of segfaulting free, and did some harmless
inits to avoid a few gcc warnings.
* plug-ins/wind/wind.c (render_wind):
replaced a segfaulting free.
(render_blast): replaced harmless malloc/free pair.
* plug-ins/bmp/bmpread.c (ReadImage):
yet another free()/g_free() problem fixed.
* plug-ins/exchange/exchange.c (real_exchange):
ditto.
* plug-ins/fp/fp.h: added Frames_Check_Button_In_A_Box proto.
* plug-ins/fp/fp_gtk.c: closing subdialogs via window manager
wasn't handled, thus leading to errors and crashes.
Now delete_event signals the dialog control button
to close a dialog with the good way.
* plug-ins/ifscompose/ifscompose.c (value_pair_create):
tried to set events mask on scale widget (a NO_WINDOW widget).
* plug-ins/png/png.c (save_image):
Replaced 2 free() with g_free() for g_malloc'ed memory.
Mysteriously I corrected the loading bug but not the saving one :)
Thu Apr 15 14:08:51 PDT 1999 Manish Singh <yosh@gimp.org>
* configure.in

View File

@ -1304,7 +1304,7 @@ make_color_map()
colormap[i][1] = gr;
colormap[i][2] = bl;
}
free(g);
g_free(g);
}
/**********************************************************************

View File

@ -287,6 +287,11 @@ static void run(gchar *name,
values[0].data.d_status = status;
gimp_drawable_detach (drawable);
if (xpostab)
g_free(xpostab);
if (ypostab)
g_free(ypostab);
}
GPlugInInfo PLUG_IN_INFO =

View File

@ -6,8 +6,13 @@
gint lightx,lighty;
BackBuffer backbuf={0,0,0,0,NULL};
/* g_free()'ed on exit */
gdouble *xpostab=NULL,*ypostab=NULL;
gint xpostab_size = -1; /* if preview size change, do realloc */
gint ypostab_size = -1;
/* Protos */
/* ====== */
@ -25,8 +30,33 @@ void compute_preview (gint startx,gint starty,gint w,gint h)
GckVector3 pos;
get_ray_func ray_func;
xpostab = (gdouble *)malloc(sizeof(gdouble)*w);
ypostab = (gdouble *)malloc(sizeof(gdouble)*h);
if (xpostab_size != w)
{
if (xpostab)
{
g_free(xpostab);
xpostab = NULL;
}
}
if (!xpostab)
{
xpostab = (gdouble *)g_malloc(sizeof(gdouble)*w);
xpostab_size = w;
}
if (ypostab_size != h)
{
if (ypostab)
{
g_free(ypostab);
ypostab = NULL;
}
}
if (!ypostab)
{
ypostab = (gdouble *)g_malloc(sizeof(gdouble)*h);
ypostab_size = h;
}
for (xcnt=0;xcnt<w;xcnt++)
xpostab[xcnt]=(gdouble)width*((gdouble)xcnt/(gdouble)w);
@ -43,7 +73,7 @@ void compute_preview (gint startx,gint starty,gint w,gint h)
if (mapvals.bump_mapped==TRUE && mapvals.bumpmap_id!=-1)
{
gimp_pixel_rgn_init (&bump_region, gimp_drawable_get(mapvals.bumpmap_id),
0, 0, width, height, FALSE, FALSE);
0, 0, width, height, FALSE, FALSE);
}
imagey=0;
@ -51,14 +81,14 @@ void compute_preview (gint startx,gint starty,gint w,gint h)
if (mapvals.previewquality)
ray_func = get_ray_color;
else
ray_func = get_ray_color_no_bilinear;
ray_func = get_ray_color_no_bilinear;
if (mapvals.env_mapped==TRUE && mapvals.envmap_id!=-1)
{
env_width = gimp_drawable_width(mapvals.envmap_id);
env_height = gimp_drawable_height(mapvals.envmap_id);
gimp_pixel_rgn_init (&env_region, gimp_drawable_get(mapvals.envmap_id),
0, 0, env_width, env_height, FALSE, FALSE);
0, 0, env_width, env_height, FALSE, FALSE);
if (mapvals.previewquality)
ray_func = get_ray_color_ref;
@ -73,53 +103,53 @@ void compute_preview (gint startx,gint starty,gint w,gint h)
if ((ycnt>=starty && ycnt<(starty+h)) &&
(xcnt>=startx && xcnt<(startx+w)))
{
imagex=xpostab[xcnt-startx];
imagey=ypostab[ycnt-starty];
pos=int_to_posf(imagex,imagey);
if (mapvals.bump_mapped==TRUE && mapvals.bumpmap_id!=-1 && xcnt==startx)
{
pos_to_float(pos.x,pos.y,&imagex,&imagey);
precompute_normals(0,width,(gint)(imagey+0.5));
}
imagex=xpostab[xcnt-startx];
imagey=ypostab[ycnt-starty];
pos=int_to_posf(imagex,imagey);
if (mapvals.bump_mapped==TRUE && mapvals.bumpmap_id!=-1 && xcnt==startx)
{
pos_to_float(pos.x,pos.y,&imagex,&imagey);
precompute_normals(0,width,(gint)(imagey+0.5));
}
color=(*ray_func)(&pos);
color=(*ray_func)(&pos);
if (color.a<1.0)
{
f1=((xcnt % 32)<16);
f2=((ycnt % 32)<16);
f1=f1^f2;
if (color.a<1.0)
{
f1=((xcnt % 32)<16);
f2=((ycnt % 32)<16);
f1=f1^f2;
if (f1)
{
if (color.a==0.0)
color=lightcheck;
else
{
gck_rgb_mul(&color,color.a);
temp=lightcheck;
gck_rgb_mul(&temp,1.0-color.a);
gck_rgb_add(&color,&temp);
}
}
else
{
if (color.a==0.0)
color=darkcheck;
else
{
gck_rgb_mul(&color,color.a);
temp=darkcheck;
gck_rgb_mul(&temp,1.0-color.a);
gck_rgb_add(&color,&temp);
}
}
}
if (f1)
{
if (color.a==0.0)
color=lightcheck;
else
{
gck_rgb_mul(&color,color.a);
temp=lightcheck;
gck_rgb_mul(&temp,1.0-color.a);
gck_rgb_add(&color,&temp);
}
}
else
{
if (color.a==0.0)
color=darkcheck;
else
{
gck_rgb_mul(&color,color.a);
temp=darkcheck;
gck_rgb_mul(&temp,1.0-color.a);
gck_rgb_add(&color,&temp);
}
}
}
preview_rgb_data[index++]=(guchar)(255.0*color.r);
preview_rgb_data[index++]=(guchar)(255.0*color.g);
preview_rgb_data[index++]=(guchar)(255.0*color.b);
imagex++;
preview_rgb_data[index++]=(guchar)(255.0*color.r);
preview_rgb_data[index++]=(guchar)(255.0*color.g);
preview_rgb_data[index++]=(guchar)(255.0*color.b);
imagex++;
}
else
{

View File

@ -66,21 +66,23 @@ void create_main_notebook (GtkWidget *);
/**************************/
gint preview_events (GtkWidget *area, GdkEvent *event);
void xyzval_update (GtkWidget *widget, GtkEntry *entry);
void entry_update (GtkWidget *widget, GtkEntry *entry);
void scale_update (GtkWidget *widget, GtkScale *scale);
void toggle_update (GtkWidget *button, gpointer data);
void toggleanti_update (GtkWidget *button, gpointer data);
void toggletips_update (GtkWidget *button, gpointer data);
void toggletrans_update (GtkWidget *button, gpointer data);
void togglebump_update (GtkWidget *button, gpointer data);
void toggleenvironment_update (GtkWidget *button, gpointer data);
void togglerefraction_update (GtkWidget *button, gpointer data);
#ifdef _LIGHTNING_UNUSED_CODE
void xyzval_update (GtkEntry *entry);
#endif
void entry_update (GtkEntry *entry);
void scale_update (GtkScale *scale);
void toggle_update (GtkWidget *button);
void toggleanti_update (GtkWidget *button);
void toggletips_update (GtkWidget *button);
void toggletrans_update (GtkWidget *button);
void togglebump_update (GtkWidget *button);
void toggleenvironment_update (GtkWidget *button);
void togglerefraction_update (GtkWidget *button);
void lightmenu_callback (GtkWidget *widget, gpointer client_data);
void preview_callback (GtkWidget *widget, gpointer client_data);
void apply_callback (GtkWidget *widget, gpointer client_data);
void exit_callback (GtkWidget *widget, gpointer client_data);
void preview_callback (GtkWidget *widget);
void apply_callback (GtkWidget *widget);
void exit_callback (GtkWidget *widget);
void color_ok_callback (GtkWidget *widget, gpointer client_data);
gint color_delete_callback (GtkWidget *widget, GdkEvent *event, gpointer client_data);
void color_changed_callback (GtkColorSelection *colorsel, gpointer client_data);
@ -100,31 +102,33 @@ void envmap_drawable_callback (gint32 id, gpointer data);
/* Implementation */
/******************/
#ifdef _LIGHTNING_UNUSED_CODE
/**********************************************************/
/* Update entry fields that affect the preview parameters */
/**********************************************************/
void xyzval_update(GtkWidget *widget, GtkEntry *entry)
void xyzval_update(GtkEntry *entry)
{
gdouble *valueptr;
gdouble value;
valueptr=(gdouble *)gtk_object_get_data(GTK_OBJECT(widget),"ValuePtr");
valueptr=(gdouble *)gtk_object_get_data(GTK_OBJECT(entry),"ValuePtr");
value = atof(gtk_entry_get_text(entry));
*valueptr=value;
}
#endif
/*********************/
/* Std. entry update */
/*********************/
void entry_update(GtkWidget *widget, GtkEntry *entry)
void entry_update(GtkEntry *entry)
{
gdouble *valueptr;
gdouble value;
valueptr=(gdouble *)gtk_object_get_data(GTK_OBJECT(widget),"ValuePtr");
valueptr=(gdouble *)gtk_object_get_data(GTK_OBJECT(entry),"ValuePtr");
value = atof(gtk_entry_get_text(entry));
*valueptr=value;
@ -134,12 +138,12 @@ void entry_update(GtkWidget *widget, GtkEntry *entry)
/* Std. scale update */
/*********************/
void scale_update(GtkWidget *widget,GtkScale *scale)
void scale_update(GtkScale *scale)
{
gdouble *valueptr;
GtkAdjustment *adjustment;
valueptr=(gdouble *)gtk_object_get_data(GTK_OBJECT(widget),"ValuePtr");
valueptr=(gdouble *)gtk_object_get_data(GTK_OBJECT(scale),"ValuePtr");
adjustment=gtk_range_get_adjustment(GTK_RANGE(scale));
*valueptr=(gdouble)adjustment->value;
@ -149,7 +153,7 @@ void scale_update(GtkWidget *widget,GtkScale *scale)
/* Std. toggle update */
/**********************/
void toggle_update(GtkWidget *button, gpointer data)
void toggle_update(GtkWidget *button)
{
gint *value;
@ -157,7 +161,7 @@ void toggle_update(GtkWidget *button, gpointer data)
*value=!(*value);
}
void togglestretch_update(GtkWidget *button, gpointer data)
void togglestretch_update(GtkWidget *button)
{
gint *value;
@ -165,7 +169,7 @@ void togglestretch_update(GtkWidget *button, gpointer data)
*value=!(*value);
}
void togglequality_update(GtkWidget *button, gpointer data)
void togglequality_update(GtkWidget *button)
{
gint *value;
@ -179,7 +183,7 @@ void togglequality_update(GtkWidget *button, gpointer data)
/* Toggle refractive layer update */
/**********************************/
void togglerefraction_update(GtkWidget *button, gpointer data)
void togglerefraction_update(GtkWidget *button)
{
gint *value;
@ -191,7 +195,7 @@ void togglerefraction_update(GtkWidget *button, gpointer data)
/* Toggle bumpmapping update */
/*****************************/
void togglebump_update(GtkWidget *button, gpointer data)
void togglebump_update(GtkWidget *button)
{
gint *value;
@ -219,7 +223,7 @@ void togglebump_update(GtkWidget *button, gpointer data)
/* Toggle environment mapping update */
/*************************************/
void toggleenvironment_update(GtkWidget *button, gpointer data)
void toggleenvironment_update(GtkWidget *button)
{
gint *value;
@ -248,7 +252,7 @@ void toggleenvironment_update(GtkWidget *button, gpointer data)
/* Antialiasing toggle update */
/******************************/
void toggleanti_update(GtkWidget *button, gpointer data)
void toggleanti_update(GtkWidget *button)
{
gint *value;
@ -260,7 +264,7 @@ void toggleanti_update(GtkWidget *button, gpointer data)
/* Tooltips toggle update */
/**************************/
void toggletips_update(GtkWidget *button, gpointer data)
void toggletips_update(GtkWidget *button)
{
gint *value;
@ -280,7 +284,7 @@ void toggletips_update(GtkWidget *button, gpointer data)
/* Transparent background toggle update */
/****************************************/
void toggletrans_update(GtkWidget *button, gpointer data)
void toggletrans_update(GtkWidget *button)
{
gint *value;
@ -343,7 +347,7 @@ void mapmenu2_callback(GtkWidget *widget, gpointer client_data)
/* Main window "Preview!" button callback */
/******************************************/
void preview_callback(GtkWidget *widget, gpointer client_data)
void preview_callback(GtkWidget *widget)
{
draw_preview_image(TRUE);
}
@ -352,7 +356,7 @@ void preview_callback(GtkWidget *widget, gpointer client_data)
/* Main window "-" (zoom in) button callback */
/*********************************************/
void zoomout_callback(GtkWidget *widget, gpointer client_data)
void zoomout_callback(GtkWidget *widget)
{
mapvals.preview_zoom_factor*=0.5;
draw_preview_image(TRUE);
@ -362,7 +366,7 @@ void zoomout_callback(GtkWidget *widget, gpointer client_data)
/* Main window "+" (zoom out) button callback */
/*********************************************/
void zoomin_callback(GtkWidget *widget, gpointer client_data)
void zoomin_callback(GtkWidget *widget)
{
mapvals.preview_zoom_factor*=2.0;
draw_preview_image(TRUE);
@ -373,7 +377,7 @@ void zoomin_callback(GtkWidget *widget, gpointer client_data)
/* Render to GIMP image, close down and exit. */
/**********************************************/
void apply_callback(GtkWidget *widget, gpointer client_data)
void apply_callback(GtkWidget *widget)
{
if (preview_rgb_data!=NULL)
free(preview_rgb_data);
@ -395,7 +399,7 @@ void apply_callback(GtkWidget *widget, gpointer client_data)
/* Main window "Cancel" button callback. Shut down and exit. */
/*************************************************************/
void exit_callback(GtkWidget *widget, gpointer client_data)
void exit_callback(GtkWidget *widget)
{
if (preview_rgb_data!=NULL)
free(preview_rgb_data);

View File

@ -62,6 +62,7 @@ SUBDIRS = \
gauss_iir \
gauss_rle \
gbr \
gdyntext \
gee \
gfig \
gfli \

View File

@ -226,7 +226,7 @@ Image ReadImage (fd, len, height, cmap, ncols, bpp, compression, spzeile, grey)
name_buf = g_malloc (strlen (filename) + 10);
sprintf (name_buf, "%s", filename);
gimp_image_set_filename(image,name_buf);
free (name_buf);
g_free (name_buf);
gimp_image_add_layer(image,layer,0);
drawable = gimp_drawable_get(layer);

View File

@ -339,8 +339,8 @@ int pluginCore(struct piArgs *argp) {
gimp_pixel_rgn_init (&src, drw, x1, y1, width, height, FALSE, FALSE);
gimp_pixel_rgn_init (&dst, drw, x1, y1, width, height, TRUE, TRUE);
srcbuf=(guchar*)malloc(rowsize*3);
dstbuf=(guchar*)malloc(rowsize);
srcbuf=(guchar*)g_malloc(rowsize*3);
dstbuf=(guchar*)g_malloc(rowsize);
memset(srcbuf,(int)0,(size_t)(rowsize*3));
memset(dstbuf,(int)0,(size_t)rowsize);
@ -372,8 +372,8 @@ int pluginCore(struct piArgs *argp) {
gimp_pixel_rgn_set_row(&dst, dstbuf, x1, y1+y+1, width);
}
free(srcbuf);
free(dstbuf);
g_free(srcbuf);
g_free(dstbuf);
gimp_drawable_flush(drw);
gimp_drawable_merge_shadow (drw->id, TRUE);
@ -473,8 +473,8 @@ emboss_do_preview(GtkWidget *w) {
ap->embossp = !mw_radio_result(rgp);
rowsize=thePreview->width*thePreview->bpp;
dst = malloc(rowsize);
c = malloc(rowsize*3);
dst = g_malloc(rowsize);
c = g_malloc(rowsize*3);
memcpy(c, thePreview->bits, rowsize);
memcpy(c+rowsize, thePreview->bits, rowsize*2);
EmbossInit(DtoR(ap->azimuth), DtoR(ap->elevation), ap->depth);
@ -491,7 +491,7 @@ emboss_do_preview(GtkWidget *w) {
dst, thePreview->width, thePreview->bpp, FALSE);
gtk_preview_draw_row(GTK_PREVIEW(theWidget),
dst, 0, thePreview->height-1, thePreview->width);
free(c);
g_free(c);
for(y=0, c=thePreview->bits;y<thePreview->height-2; y++, c+=rowsize){
EmbossRow(c, ap->embossp ? (guchar *)0 : c,
@ -502,7 +502,7 @@ emboss_do_preview(GtkWidget *w) {
gtk_widget_draw(theWidget, NULL);
gdk_flush();
free(dst);
g_free(dst);
}
/*

View File

@ -515,8 +515,8 @@ void real_exchange(gint x1, gint y1, gint x2, gint y2, int dopreview)
if (! dopreview && (y % 10) == 0)
gimp_progress_update((double) y / (double) height);
}
free(src_row);
free(dest_row);
g_free(src_row);
g_free(dest_row);
if (! dopreview)
{
/* update the processed region */

View File

@ -268,11 +268,11 @@ static void pixels_free( void )
{
gint y;
for( y = 0; y < image.height; y++ ){
free( spixels[y] );
free( dpixels[y] );
g_free( spixels[y] );
g_free( dpixels[y] );
}
free( spixels );
free( dpixels );
g_free( spixels );
g_free( dpixels );
}
static void pixels_get( gint x, gint y, pixel_t *pixel )
@ -750,9 +750,9 @@ static gint dialog_show( void )
GtkWidget *button;
button = gtk_button_new_with_label( "OK" );
gtk_signal_connect_object( GTK_OBJECT( button ), "clicked",
GTK_SIGNAL_FUNC( dialog_ok_callback ),
GTK_OBJECT( dialog ) );
gtk_signal_connect( GTK_OBJECT( button ), "clicked",
GTK_SIGNAL_FUNC( dialog_ok_callback ),
GTK_OBJECT( dialog ) );
gtk_box_pack_start( GTK_BOX( GTK_DIALOG( dialog )->action_area ),
button, TRUE, TRUE, 0 );
GTK_WIDGET_SET_FLAGS( button, GTK_CAN_DEFAULT );
@ -760,17 +760,17 @@ static gint dialog_show( void )
gtk_widget_show( button );
button = gtk_button_new_with_label( "Cancel" );
gtk_signal_connect_object( GTK_OBJECT( button ), "clicked",
GTK_SIGNAL_FUNC( dialog_cancel_callback ),
GTK_OBJECT( dialog ) );
gtk_signal_connect( GTK_OBJECT( button ), "clicked",
GTK_SIGNAL_FUNC( dialog_cancel_callback ),
GTK_OBJECT( dialog ) );
gtk_box_pack_start( GTK_BOX( GTK_DIALOG( dialog )->action_area ),
button, TRUE, TRUE, 0 );
gtk_widget_show( button );
button = gtk_button_new_with_label( "Help" );
gtk_signal_connect_object( GTK_OBJECT( button ), "clicked",
GTK_SIGNAL_FUNC( dialog_help_callback ),
GTK_OBJECT( dialog ) );
gtk_signal_connect( GTK_OBJECT( button ), "clicked",
GTK_SIGNAL_FUNC( dialog_help_callback ),
GTK_OBJECT( dialog ) );
gtk_box_pack_start( GTK_BOX( GTK_DIALOG( dialog )->action_area ),
button, TRUE, TRUE, 0 );
gtk_widget_show( button );

View File

@ -317,9 +317,9 @@ static int dialog( void )
/* ok button */
button = gtk_button_new_with_label( "OK" );
gtk_signal_connect_object( GTK_OBJECT( button ), "clicked",
GTK_SIGNAL_FUNC( dialog_ok_handler ),
GTK_OBJECT( window ) );
gtk_signal_connect( GTK_OBJECT( button ), "clicked",
GTK_SIGNAL_FUNC( dialog_ok_handler ),
GTK_OBJECT( window ) );
GTK_WIDGET_SET_FLAGS( button, GTK_CAN_DEFAULT );
gtk_box_pack_start( GTK_BOX( GTK_DIALOG( window )->action_area ),
button, TRUE, TRUE, 0 );
@ -328,9 +328,9 @@ static int dialog( void )
/* cancel button */
button = gtk_button_new_with_label( "Cancel" );
gtk_signal_connect_object( GTK_OBJECT( button ), "clicked",
GTK_SIGNAL_FUNC( dialog_cancel_handler ),
GTK_OBJECT( window )) ;
gtk_signal_connect( GTK_OBJECT( button ), "clicked",
GTK_SIGNAL_FUNC( dialog_cancel_handler ),
GTK_OBJECT( window )) ;
gtk_box_pack_start( GTK_BOX( GTK_DIALOG( window )->action_area ),
button, TRUE, TRUE, 0 );
gtk_widget_show( button );

View File

@ -918,15 +918,15 @@ void ok_button_clicked(GtkWidget *widget, gpointer client_data)
gtk_widget_hide((GtkWidget *)client_data);
gdk_flush();
compute_image();
gtk_widget_destroy((GtkWidget *)client_data);
gtk_main_quit();
}
void cancel_button_clicked(GtkWidget *widget, gpointer client_data)
{
gtk_widget_destroy((GtkWidget *)client_data);
gtk_main_quit();
}
void dialog_destroy(GtkWidget *widget, gpointer client_data)
void dialog_destroy(GtkWidget *widget, GdkEvent *ev, gpointer client_data)
{
gtk_main_quit();
}
@ -989,7 +989,7 @@ void create_main_dialog(void)
gtk_window_set_title(GTK_WINDOW(dialog), "Van Gogh (LIC)");
gtk_window_position(GTK_WINDOW(dialog), GTK_WIN_POS_MOUSE);
gtk_container_border_width(GTK_CONTAINER(dialog), 0);
gtk_signal_connect(GTK_OBJECT(dialog), "destroy",
gtk_signal_connect(GTK_OBJECT(dialog), "delete_event",
(GtkSignalFunc)dialog_destroy, (gpointer)dialog);
hbox = gtk_hbox_new(FALSE,5);

View File

@ -37,6 +37,105 @@
* Revision History:
*
* $Log$
* Revision 1.14 1999/04/15 21:48:59 yosh
* * applied gimp-lecorfec-99041[02]-0, changes follow
*
* * plug-ins/FractalExplorer/Dialogs.h (make_color_map):
* replaced free with g_free to fix segfault.
*
* * plug-ins/Lighting/lighting_preview.c (compute_preview):
* allocate xpostab and ypostab only when needed (it could also be
* allocated on stack with a compilation-fixed size like MapObject).
* It avoids to lose some Kb on each preview :)
* Also reindented (unfortunate C-c C-q) some other lines.
*
* * plug-ins/Lighting/lighting_main.c (run):
* release allocated postabs.
*
* * plug-ins/Lighting/lighting_ui.c:
* callbacks now have only one argument because gck widget use
* gtk_signal_connect_object. Caused segfault for scale widget.
*
* * plug-ins/autocrop/autocrop.c (doit):
* return if image has only background (thus fixing a segfault).
*
* * plug-ins/emboss/emboss.c (pluginCore, emboss_do_preview):
* replaced malloc/free with g_malloc/g_free (unneeded, but
* shouldn't everyone use glib calls ? :)
*
* * plug-ins/flame/flame.c :
* replaced a segfaulting free, and several harmless malloc/free pairs.
*
* * plug-ins/flame/megawidget.c (mw_preview_build):
* replaced harmless malloc/free pair.
* Note : mwp->bits is malloc'ed but seems to be never freed.
*
* * plug-ins/fractaltrace/fractaltrace.c (pixels_free):
* replaced a bunch of segfaulting free.
* (pixels_get, dialog_show): replaced gtk_signal_connect_object
* with gtk_signal_connect to accomodate callbacks (caused STRANGE
* dialog behaviour, coz you destroyed buttons one by one).
*
* * plug-ins/illusion/illusion.c (dialog):
* same gtk_signal_connect_object replacement for same reasons.
*
* * plug-ins/libgck/gck/gckcolor.c :
* changed all gck_rgb_to_color* functions to use a static GdkColor
* instead of a malloc'ed area. Provided reentrant functions with
* the old behaviour (gck_rgb_to_color*_r). Made some private functions
* static, too.
* gck_rgb_to_gdkcolor now use the new functions while
* gck_rgb_to_gdkcolor_r is the reentrant version.
* Also affected by this change: gck_gc_set_foreground and
* gck_gc_set_background (no more free(color)).
*
* * plug-ins/libgck/gck/gckcolor.h :
* added the gck_rgb_to_gdkcolor_r proto.
*
* * plug-ins/lic/lic.c (ok_button_clicked, cancel_button_clicked) :
* segfault on gtk_widget_destroy, now calls gtk_main_quit.
* (dialog_destroy) : segfault on window closure when called by
* "destroy" event. Now called by "delete_event".
*
* * plug-ins/megawidget/megawidget.c (mw_preview_build):
* replaced harmless malloc/free pair.
* Note : mwp->bits is malloc'ed but seems to be never freed.
*
* * plug-ins/png/png.c (load_image):
* replaced 2 segfaulting free.
*
* * plug-ins/print/print-ps.c (ps_print):
* replaced a segfaulting free (called many times :).
*
* * plug-ins/sgi/sgi.c (load_image, save_image):
* replaced a bunch of segfaulting free, and did some harmless
* inits to avoid a few gcc warnings.
*
* * plug-ins/wind/wind.c (render_wind):
* replaced a segfaulting free.
* (render_blast): replaced harmless malloc/free pair.
*
* * plug-ins/bmp/bmpread.c (ReadImage):
* yet another free()/g_free() problem fixed.
*
* * plug-ins/exchange/exchange.c (real_exchange):
* ditto.
*
* * plug-ins/fp/fp.h: added Frames_Check_Button_In_A_Box proto.
* * plug-ins/fp/fp_gtk.c: closing subdialogs via window manager
* wasn't handled, thus leading to errors and crashes.
* Now delete_event signals the dialog control button
* to close a dialog with the good way.
*
* * plug-ins/ifscompose/ifscompose.c (value_pair_create):
* tried to set events mask on scale widget (a NO_WINDOW widget).
*
* * plug-ins/png/png.c (save_image):
* Replaced 2 free() with g_free() for g_malloc'ed memory.
* Mysteriously I corrected the loading bug but not the saving one :)
*
* -Yosh
*
* Revision 1.13 1999/01/15 17:34:20 unammx
* 1999-01-15 Federico Mena Quintero <federico@nuclecu.unam.mx>
*
@ -600,8 +699,8 @@ load_image(char *filename) /* I - File to load */
png_read_end(pp, info);
png_read_destroy(pp, info, NULL);
free(pixel);
free(pixels);
g_free(pixel);
g_free(pixels);
free(pp);
free(info);
@ -793,8 +892,8 @@ save_image(char *filename, /* I - File to save to */
png_write_end(pp, info);
png_write_destroy(pp);
free(pixel);
free(pixels);
g_free(pixel);
g_free(pixels);
/*
* Done with the file...

View File

@ -273,7 +273,7 @@ render_blast(GDrawable *drawable, gint threshold, gint strength,
gimp_pixel_rgn_init(&src_region, drawable, 0, 0, width, height, FALSE, FALSE);
gimp_pixel_rgn_init(&dest_region, drawable, 0, 0, width, height, TRUE, TRUE);
buffer = malloc(row_stride);
buffer = (guchar *)g_malloc(row_stride);
for (row = y1; row < y2; row++)
{
@ -307,7 +307,7 @@ render_blast(GDrawable *drawable, gint threshold, gint strength,
marker = 0;
}
} /* for */
free(buffer);
g_free(buffer);
/* update the region */
gimp_drawable_flush(drawable);
@ -355,7 +355,7 @@ render_wind(GDrawable *drawable, gint threshold, gint strength,
gimp_pixel_rgn_set_row(&dest_region, sb, x1, row, width);
gimp_progress_update((gdouble) row / (gdouble) (y2 - y1));
}
free(sb);
g_free(sb);
gimp_drawable_flush(drawable);
gimp_drawable_merge_shadow(drawable->id, TRUE);
gimp_drawable_update(drawable->id, x1, y1, x2 - x1, y2 - y1);

View File

@ -339,8 +339,8 @@ int pluginCore(struct piArgs *argp) {
gimp_pixel_rgn_init (&src, drw, x1, y1, width, height, FALSE, FALSE);
gimp_pixel_rgn_init (&dst, drw, x1, y1, width, height, TRUE, TRUE);
srcbuf=(guchar*)malloc(rowsize*3);
dstbuf=(guchar*)malloc(rowsize);
srcbuf=(guchar*)g_malloc(rowsize*3);
dstbuf=(guchar*)g_malloc(rowsize);
memset(srcbuf,(int)0,(size_t)(rowsize*3));
memset(dstbuf,(int)0,(size_t)rowsize);
@ -372,8 +372,8 @@ int pluginCore(struct piArgs *argp) {
gimp_pixel_rgn_set_row(&dst, dstbuf, x1, y1+y+1, width);
}
free(srcbuf);
free(dstbuf);
g_free(srcbuf);
g_free(dstbuf);
gimp_drawable_flush(drw);
gimp_drawable_merge_shadow (drw->id, TRUE);
@ -473,8 +473,8 @@ emboss_do_preview(GtkWidget *w) {
ap->embossp = !mw_radio_result(rgp);
rowsize=thePreview->width*thePreview->bpp;
dst = malloc(rowsize);
c = malloc(rowsize*3);
dst = g_malloc(rowsize);
c = g_malloc(rowsize*3);
memcpy(c, thePreview->bits, rowsize);
memcpy(c+rowsize, thePreview->bits, rowsize*2);
EmbossInit(DtoR(ap->azimuth), DtoR(ap->elevation), ap->depth);
@ -491,7 +491,7 @@ emboss_do_preview(GtkWidget *w) {
dst, thePreview->width, thePreview->bpp, FALSE);
gtk_preview_draw_row(GTK_PREVIEW(theWidget),
dst, 0, thePreview->height-1, thePreview->width);
free(c);
g_free(c);
for(y=0, c=thePreview->bits;y<thePreview->height-2; y++, c+=rowsize){
EmbossRow(c, ap->embossp ? (guchar *)0 : c,
@ -502,7 +502,7 @@ emboss_do_preview(GtkWidget *w) {
gtk_widget_draw(theWidget, NULL);
gdk_flush();
free(dst);
g_free(dst);
}
/*

View File

@ -515,8 +515,8 @@ void real_exchange(gint x1, gint y1, gint x2, gint y2, int dopreview)
if (! dopreview && (y % 10) == 0)
gimp_progress_update((double) y / (double) height);
}
free(src_row);
free(dest_row);
g_free(src_row);
g_free(dest_row);
if (! dopreview)
{
/* update the processed region */

View File

@ -236,11 +236,11 @@ drawable_to_cmap(control_point *cp) {
for (i = 0; i < 256; i++)
for (j = 0; j < 3; j++)
cp->cmap[i][j] = g[i*4 + j];
free(g);
g_free(g);
} else {
d = gimp_drawable_get(config.cmap_drawable);
indexed = gimp_drawable_indexed(config.cmap_drawable);
p = (guchar *) malloc(d->bpp);
p = (guchar *) g_malloc(d->bpp);
gimp_pixel_rgn_init(&pr, d, 0, 0,
d->width, d->height, FALSE, FALSE);
for (i = 0; i < 256; i++) {
@ -250,7 +250,7 @@ drawable_to_cmap(control_point *cp) {
cp->cmap[i][j] =
(d->bpp >= 3) ? (p[j] / 255.0) : (p[0]/255.0);
}
free(p);
g_free(p);
}
}
@ -269,7 +269,7 @@ static void doit(GDrawable * drawable)
return;
}
tmp = (guchar *) malloc(width * height * 4);
tmp = (guchar *) g_malloc(width * height * 4);
if (tmp == NULL) {
fprintf(stderr, "cannot malloc %d bytes.\n", width * height * bytes);
return;
@ -293,7 +293,7 @@ static void doit(GDrawable * drawable)
} else if (3 == bytes) {
int i, j;
GPixelRgn src_pr, dst_pr;
guchar *sl = (guchar *) malloc(3 * width);
guchar *sl = (guchar *) g_malloc(3 * width);
if (sl == NULL) {
fprintf(stderr, "cannot malloc %d bytes.\n", width * 3);
return;
@ -318,10 +318,10 @@ static void doit(GDrawable * drawable)
}
gimp_pixel_rgn_set_rect(&dst_pr, sl, 0, i, width, 1);
}
free(sl);
g_free(sl);
} else
printf("oops\n");
free(tmp);
g_free(tmp);
gimp_drawable_flush(drawable);
gimp_drawable_merge_shadow(drawable->id, TRUE);
gimp_drawable_update(drawable->id, 0, 0, width, height);
@ -454,7 +454,7 @@ static void set_edit_preview() {
if (NULL == edit_previews[0]) return;
b = malloc(nbytes);
b = g_malloc(nbytes);
maybe_init_cp();
drawable_to_cmap(&edit_cp);
for (i = 0; i < 3; i++)
@ -490,7 +490,7 @@ static void set_edit_preview() {
0, y, edit_preview_size);
gtk_widget_draw (edit_previews[mut], NULL);
}
free(b);
g_free(b);
}
static void preview_clicked(GtkWidget * widget, gpointer data) {
@ -705,7 +705,7 @@ static void set_flame_preview() {
if (NULL == flame_preview)
return;
b = malloc(preview_width * preview_height * 3);
b = g_malloc(preview_width * preview_height * 3);
maybe_init_cp();
drawable_to_cmap(&config.cp);
@ -724,7 +724,7 @@ static void set_flame_preview() {
for (y = 0; y < preview_size; y++)
gtk_preview_draw_row(GTK_PREVIEW (flame_preview),
b+y*preview_width*3, 0, y, preview_width);
free(b);
g_free(b);
gtk_widget_draw (flame_preview, NULL);
}

View File

@ -183,7 +183,7 @@ mw_preview_build(GDrawable *drw) {
mwp= mw_preview_build_virgin(drw);
gimp_pixel_rgn_init(&pr, drw, 0, 0, drw->width, drw->height, FALSE, FALSE);
drwBits = (guchar *)malloc(drw->width * drw->bpp);
drwBits = (guchar *)g_malloc(drw->width * drw->bpp);
mwp->bpp = 3;
bc = mwp->bits = (guchar *)malloc(mwp->width*mwp->height*mwp->bpp);
@ -194,7 +194,7 @@ mw_preview_build(GDrawable *drw) {
*bc++=*(drwBits+((gint)(x*mwp->scale)*drw->bpp)+b);
}
}
free(drwBits);
g_free(drwBits);
return(mwp);
}

View File

@ -183,6 +183,12 @@ void Check_Button_In_A_Box (GtkWidget *,
gpointer data,
int clicked);
void Frames_Check_Button_In_A_Box (GtkWidget *,
guchar *label,
GtkSignalFunc func,
GtkWidget *frame,
int clicked);
void Adjust_Preview_Sizes (int width,
int height );
void refreshPreviews (int);

View File

@ -98,6 +98,16 @@ GtkWidget *fp_create_bna(void)
return frame;
}
/* close a sub dialog (from window manager) by simulating toggle click */
void sub_dialog_destroy(GtkWidget *dialog, GdkEvent *ev, gpointer dummy)
{
GtkWidget *button = GTK_WIDGET(
gtk_object_get_data(GTK_OBJECT(dialog), "ctrlButton"));
gtk_signal_emit_by_name(GTK_OBJECT(button), "clicked", dialog);
}
GtkWidget *fp_create_circle_palette(void)
{
GtkWidget *frame, *table;
@ -158,6 +168,8 @@ GtkWidget *fp_create_circle_palette(void)
win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(win),"Hue Variations");
gtk_container_add(GTK_CONTAINER(win),frame);
gtk_signal_connect(GTK_OBJECT(win), "delete_event",
(GtkSignalFunc)sub_dialog_destroy, NULL);
return win;
}
@ -246,19 +258,19 @@ GtkWidget *fp_create_control(void)
gtk_container_border_width(GTK_CONTAINER(box),5);
gtk_widget_show(box);
Check_Button_In_A_Box(box,"Hue",
Frames_Check_Button_In_A_Box(box,"Hue",
(GtkSignalFunc) fp_show_hide_frame,
fpFrames.palette,
Current.VisibleFrames&HUE);
Check_Button_In_A_Box(box,"Saturation",
Frames_Check_Button_In_A_Box(box,"Saturation",
(GtkSignalFunc) fp_show_hide_frame,
fpFrames.satur,
Current.VisibleFrames&SATURATION);
Check_Button_In_A_Box(box,"Value",
Frames_Check_Button_In_A_Box(box,"Value",
(GtkSignalFunc) fp_show_hide_frame,
fpFrames.lnd,
Current.VisibleFrames&VALUE);
Check_Button_In_A_Box(box,"Advanced",
Frames_Check_Button_In_A_Box(box,"Advanced",
(GtkSignalFunc) fp_show_hide_frame,
AW.window,
FALSE);
@ -303,6 +315,8 @@ GtkWidget *fp_create_lnd()
win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(win),"Value Variations");
gtk_container_add(GTK_CONTAINER(win),frame);
gtk_signal_connect(GTK_OBJECT(win), "delete_event",
(GtkSignalFunc)sub_dialog_destroy, NULL);
return win;
}
@ -345,6 +359,8 @@ GtkWidget *fp_create_msnls()
win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(win),"Saturation Variations");
gtk_container_add(GTK_CONTAINER(win),frame);
gtk_signal_connect(GTK_OBJECT(win), "delete_event",
(GtkSignalFunc)sub_dialog_destroy, NULL);
return win;
}
@ -412,6 +428,8 @@ GtkWidget *fp_create_show()
FALSE);
return frame;
}
#ifdef __FP_UNUSED_STUFF__
GtkWidget *fp_create_frame_select()
{
GtkWidget *frame, *box;
@ -436,6 +454,7 @@ GtkWidget *fp_create_frame_select()
fpFrames.satur,FALSE);
return frame;
}
#endif
void Create_A_Preview (GtkWidget **preview,
GtkWidget **frame,
@ -494,6 +513,26 @@ void Check_Button_In_A_Box (GtkWidget *vbox,
gtk_widget_show(button);
}
void Frames_Check_Button_In_A_Box (GtkWidget *vbox,
guchar *label,
GtkSignalFunc function,
GtkWidget *frame,
int clicked)
{
GtkWidget *button;
button=gtk_check_button_new_with_label(label);
gtk_signal_connect (GTK_OBJECT (button), "clicked",
(GtkSignalFunc) function,
frame);
gtk_box_pack_start (GTK_BOX(vbox),button, TRUE, TRUE, 0);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button),clicked);
gtk_object_set_data(GTK_OBJECT(frame), "ctrlButton", (gpointer)button);
gtk_widget_show(button);
}
void Create_A_Table_Entry (GtkWidget **box,
GtkWidget *SmallerFrame,
@ -594,7 +633,7 @@ void fp_show_hide_frame (GtkWidget *button,
{
int prev=Current.VisibleFrames;
if (frame == NULL) return;
if (GTK_TOGGLE_BUTTON(button)->active)
if (GTK_TOGGLE_BUTTON(button)->active) {
if (!GTK_WIDGET_VISIBLE(frame)) {
gtk_widget_show(frame);
if (frame==fpFrames.palette)
@ -605,9 +644,8 @@ void fp_show_hide_frame (GtkWidget *button,
Current.VisibleFrames |= VALUE;
refreshPreviews(Current.VisibleFrames & ~prev);
}
else ;
else
}
else {
if (GTK_WIDGET_VISIBLE(frame)) {
gtk_widget_hide(frame);
if (frame==fpFrames.palette)
@ -617,6 +655,7 @@ void fp_show_hide_frame (GtkWidget *button,
else if (frame==fpFrames.lnd)
Current.VisibleFrames &= ~VALUE;
}
}
}
void Adjust_Preview_Sizes(int width, int height)
@ -979,6 +1018,8 @@ gint fp_advanced_dialog()
AW.window=gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(AW.window),"Advanced Filter Pack Options");
gtk_signal_connect(GTK_OBJECT(AW.window), "delete_event",
(GtkSignalFunc)sub_dialog_destroy, NULL);
mainvbox=gtk_hbox_new(FALSE,5);
gtk_container_add(GTK_CONTAINER(AW.window),mainvbox);

View File

@ -268,11 +268,11 @@ static void pixels_free( void )
{
gint y;
for( y = 0; y < image.height; y++ ){
free( spixels[y] );
free( dpixels[y] );
g_free( spixels[y] );
g_free( dpixels[y] );
}
free( spixels );
free( dpixels );
g_free( spixels );
g_free( dpixels );
}
static void pixels_get( gint x, gint y, pixel_t *pixel )
@ -750,9 +750,9 @@ static gint dialog_show( void )
GtkWidget *button;
button = gtk_button_new_with_label( "OK" );
gtk_signal_connect_object( GTK_OBJECT( button ), "clicked",
GTK_SIGNAL_FUNC( dialog_ok_callback ),
GTK_OBJECT( dialog ) );
gtk_signal_connect( GTK_OBJECT( button ), "clicked",
GTK_SIGNAL_FUNC( dialog_ok_callback ),
GTK_OBJECT( dialog ) );
gtk_box_pack_start( GTK_BOX( GTK_DIALOG( dialog )->action_area ),
button, TRUE, TRUE, 0 );
GTK_WIDGET_SET_FLAGS( button, GTK_CAN_DEFAULT );
@ -760,17 +760,17 @@ static gint dialog_show( void )
gtk_widget_show( button );
button = gtk_button_new_with_label( "Cancel" );
gtk_signal_connect_object( GTK_OBJECT( button ), "clicked",
GTK_SIGNAL_FUNC( dialog_cancel_callback ),
GTK_OBJECT( dialog ) );
gtk_signal_connect( GTK_OBJECT( button ), "clicked",
GTK_SIGNAL_FUNC( dialog_cancel_callback ),
GTK_OBJECT( dialog ) );
gtk_box_pack_start( GTK_BOX( GTK_DIALOG( dialog )->action_area ),
button, TRUE, TRUE, 0 );
gtk_widget_show( button );
button = gtk_button_new_with_label( "Help" );
gtk_signal_connect_object( GTK_OBJECT( button ), "clicked",
GTK_SIGNAL_FUNC( dialog_help_callback ),
GTK_OBJECT( dialog ) );
gtk_signal_connect( GTK_OBJECT( button ), "clicked",
GTK_SIGNAL_FUNC( dialog_help_callback ),
GTK_OBJECT( dialog ) );
gtk_box_pack_start( GTK_BOX( GTK_DIALOG( dialog )->action_area ),
button, TRUE, TRUE, 0 );
gtk_widget_show( button );

View File

@ -2223,9 +2223,6 @@ value_pair_create (gpointer data, gdouble lower, gdouble upper,
"button_release_event",
(GtkSignalFunc) value_pair_button_release,
NULL);
gtk_widget_set_events (value_pair->scale,
gtk_widget_get_events(GTK_WIDGET (value_pair->scale))
| GDK_BUTTON_RELEASE_MASK );
}
else
value_pair->scale = NULL;

View File

@ -317,9 +317,9 @@ static int dialog( void )
/* ok button */
button = gtk_button_new_with_label( "OK" );
gtk_signal_connect_object( GTK_OBJECT( button ), "clicked",
GTK_SIGNAL_FUNC( dialog_ok_handler ),
GTK_OBJECT( window ) );
gtk_signal_connect( GTK_OBJECT( button ), "clicked",
GTK_SIGNAL_FUNC( dialog_ok_handler ),
GTK_OBJECT( window ) );
GTK_WIDGET_SET_FLAGS( button, GTK_CAN_DEFAULT );
gtk_box_pack_start( GTK_BOX( GTK_DIALOG( window )->action_area ),
button, TRUE, TRUE, 0 );
@ -328,9 +328,9 @@ static int dialog( void )
/* cancel button */
button = gtk_button_new_with_label( "Cancel" );
gtk_signal_connect_object( GTK_OBJECT( button ), "clicked",
GTK_SIGNAL_FUNC( dialog_cancel_handler ),
GTK_OBJECT( window )) ;
gtk_signal_connect( GTK_OBJECT( button ), "clicked",
GTK_SIGNAL_FUNC( dialog_cancel_handler ),
GTK_OBJECT( window )) ;
gtk_box_pack_start( GTK_BOX( GTK_DIALOG( window )->action_area ),
button, TRUE, TRUE, 0 );
gtk_widget_show( button );

View File

@ -1027,16 +1027,12 @@ void gck_visualinfo_set_dither(GckVisualInfo * visinfo, GckDitherType method)
void gck_gc_set_foreground(GckVisualInfo *visinfo,GdkGC *gc,
guchar r, guchar g, guchar b)
{
GdkColor *color;
{
g_function_enter("gck_gc_set_foreground");
g_assert(visinfo!=NULL);
g_assert(gc!=NULL);
color=gck_rgb_to_gdkcolor(visinfo,r,g,b);
gdk_gc_set_foreground(gc,color);
free(color);
gdk_gc_set_foreground(gc, gck_rgb_to_gdkcolor(visinfo,r,g,b));
g_function_leave("gck_gc_set_foreground");
}
@ -1044,15 +1040,11 @@ void gck_gc_set_foreground(GckVisualInfo *visinfo,GdkGC *gc,
void gck_gc_set_background(GckVisualInfo *visinfo,GdkGC *gc,
guchar r, guchar g, guchar b)
{
GdkColor *color;
g_function_enter("gck_gc_set_background");
g_assert(visinfo!=NULL);
g_assert(gc!=NULL);
color=gck_rgb_to_gdkcolor(visinfo,r,g,b);
gdk_gc_set_background(gc,color);
free(color);
gdk_gc_set_background(gc, gck_rgb_to_gdkcolor(visinfo,r,g,b));
g_function_leave("gck_gc_set_background");
}
@ -1061,12 +1053,38 @@ void gck_gc_set_background(GckVisualInfo *visinfo,GdkGC *gc,
/* RGB to 8 bpp pseudocolor (indexed) functions. */
/*************************************************/
GdkColor *gck_rgb_to_color8(GckVisualInfo * visinfo, guchar r, guchar g, guchar b)
/*
* Non-reentrant function - GdkColor is a static storage
*/
static GdkColor *
gck_rgb_to_color8(GckVisualInfo * visinfo, guchar r, guchar g, guchar b)
{
static GdkColor color;
gint index;
g_function_enter("gck_rgb_to_color8");
g_assert(visinfo!=NULL);
r = visinfo->map_r[r];
g = visinfo->map_g[g];
b = visinfo->map_b[b];
index = visinfo->indextab[r][g][b];
color=visinfo->rgbpalette[index];
g_function_leave("gck_rgb_to_color8");
return (&color);
}
/*
* Reentrant function - GdkColor will be malloc'ed
*/
static GdkColor *
gck_rgb_to_color8_r(GckVisualInfo * visinfo, guchar r, guchar g, guchar b)
{
gint index;
GdkColor *color;
g_function_enter("gck_rgb_to_color8");
g_function_enter("gck_rgb_to_color8_r");
g_assert(visinfo!=NULL);
color=(GdkColor *)malloc(sizeof(GdkColor));
@ -1079,7 +1097,7 @@ GdkColor *gck_rgb_to_color8(GckVisualInfo * visinfo, guchar r, guchar g, guchar
index = visinfo->indextab[r][g][b];
*color=visinfo->rgbpalette[index];
g_function_leave("gck_rgb_to_color8");
g_function_leave("gck_rgb_to_color8_r");
return (color);
}
@ -1089,8 +1107,9 @@ GdkColor *gck_rgb_to_color8(GckVisualInfo * visinfo, guchar r, guchar g, guchar
/* and Steinberg (aka "Floyd-Steinberg dithering") */
/***************************************************/
void gck_rgb_to_image8_fs_dither(GckVisualInfo * visinfo, guchar * RGB_data, GdkImage * image,
int width, int height)
static void
gck_rgb_to_image8_fs_dither(GckVisualInfo * visinfo, guchar * RGB_data, GdkImage * image,
int width, int height)
{
guchar *imagedata;
gint or, og, ob, mr, mg, mb, dr, dg, db;
@ -1307,10 +1326,11 @@ void gck_rgb_to_image8_fs_dither(GckVisualInfo * visinfo, guchar * RGB_data, Gdk
/* Plain (no dithering) RGB to 8 bpp pseudocolor (indexed) */
/***********************************************************/
void gck_rgb_to_image8(GckVisualInfo * visinfo,
guchar * RGB_data,
GdkImage * image,
int width, int height)
static void
gck_rgb_to_image8(GckVisualInfo * visinfo,
guchar * RGB_data,
GdkImage * image,
int width, int height)
{
guchar *imagedata, r, g, b;
int xcnt, ycnt, diffx;
@ -1356,12 +1376,46 @@ void gck_rgb_to_image8(GckVisualInfo * visinfo,
/* RGB to 16/15 bpp RGB ("HiColor") */
/************************************/
GdkColor *gck_rgb_to_color16(GckVisualInfo * visinfo, guchar r, guchar g, guchar b)
/*
* Non-reentrant function - GdkColor is a static storage
*/
static GdkColor *
gck_rgb_to_color16(GckVisualInfo * visinfo, guchar r, guchar g, guchar b)
{
static GdkColor color;
guint32 red, green, blue;
g_function_enter("gck_rgb_to_color16");
g_assert(visinfo!=NULL);
color.red = ((guint16) r) << 8;
color.green = ((guint16) g) << 8;
color.blue = ((guint16) b) << 8;
red = ((guint32) r) >> (8 - visinfo->visual->red_prec);
green = ((guint32) g) >> (8 - visinfo->visual->green_prec);
blue = ((guint32) b) >> (8 - visinfo->visual->blue_prec);
red = red << visinfo->visual->red_shift;
green = green << visinfo->visual->green_shift;
blue = blue << visinfo->visual->blue_shift;
color.pixel = red | green | blue;
g_function_leave("gck_rgb_to_color16");
return (&color);
}
/*
* Reentrant function - GdkColor will be malloc'ed
*/
static GdkColor *
gck_rgb_to_color16_r(GckVisualInfo * visinfo, guchar r, guchar g, guchar b)
{
guint32 red, green, blue;
GdkColor *color;
g_function_enter("gck_rgb_to_color16");
g_function_enter("gck_rgb_to_color16_r");
g_assert(visinfo!=NULL);
color=(GdkColor *)malloc(sizeof(GdkColor));
@ -1382,7 +1436,7 @@ GdkColor *gck_rgb_to_color16(GckVisualInfo * visinfo, guchar r, guchar g, guchar
color->pixel = red | green | blue;
g_function_leave("gck_rgb_to_color16");
g_function_leave("gck_rgb_to_color16_r");
return (color);
}
@ -1392,10 +1446,11 @@ GdkColor *gck_rgb_to_color16(GckVisualInfo * visinfo, guchar r, guchar g, guchar
/* and Steinberg (aka "Floyd-Steinberg dithering") */
/***************************************************/
void gck_rgb_to_image16_fs_dither(GckVisualInfo * visinfo,
guchar * RGB_data,
GdkImage * image,
int width, int height)
static void
gck_rgb_to_image16_fs_dither(GckVisualInfo * visinfo,
guchar * RGB_data,
GdkImage * image,
int width, int height)
{
guint16 *imagedata, pixel;
gint16 or, og, ob, dr, dg, db;
@ -1622,10 +1677,11 @@ void gck_rgb_to_image16_fs_dither(GckVisualInfo * visinfo,
g_function_leave("gck_rgb_to_image16_fs_dither");
}
void gck_rgb_to_image16(GckVisualInfo * visinfo,
guchar * RGB_data,
GdkImage * image,
int width, int height)
static void
gck_rgb_to_image16(GckVisualInfo * visinfo,
guchar * RGB_data,
GdkImage * image,
int width, int height)
{
guint16 *imagedata, pixel, r, g, b;
int xcnt, ycnt, diffx;
@ -1672,12 +1728,42 @@ void gck_rgb_to_image16(GckVisualInfo * visinfo,
/* RGB to RGB (sic!) :) */
/************************/
GdkColor *gck_rgb_to_color24(GckVisualInfo * visinfo, guchar r, guchar g, guchar b)
/*
* Non-reentrant function - GdkColor is a static storage
*/
static GdkColor *
gck_rgb_to_color24(GckVisualInfo * visinfo, guchar r, guchar g, guchar b)
{
static GdkColor color;
guint32 red, green, blue;
g_function_enter("gck_rgb_to_color24");
g_assert(visinfo!=NULL);
color.red = ((guint16) r) << 8;
color.green = ((guint16) g) << 8;
color.blue = ((guint16) b) << 8;
red = ((guint32) r << 16);
green = ((guint32) g) << 8;
blue = ((guint32) b);
color.pixel = red | green | blue;
g_function_leave("gck_rgb_to_color24");
return (&color);
}
/*
* Reentrant function - GdkColor will be malloc'ed
*/
static GdkColor *
gck_rgb_to_color24_r(GckVisualInfo * visinfo, guchar r, guchar g, guchar b)
{
guint32 red, green, blue;
GdkColor *color;
g_function_enter("gck_rgb_to_color24");
g_function_enter("gck_rgb_to_color24_r");
g_assert(visinfo!=NULL);
color=(GdkColor *)malloc(sizeof(GdkColor));
@ -1694,14 +1780,15 @@ GdkColor *gck_rgb_to_color24(GckVisualInfo * visinfo, guchar r, guchar g, guchar
color->pixel = red | green | blue;
g_function_leave("gck_rgb_to_color24");
g_function_leave("gck_rgb_to_color24_r");
return (color);
}
void gck_rgb_to_image24(GckVisualInfo * visinfo,
guchar * RGB_data,
GdkImage * image,
int width, int height)
static void
gck_rgb_to_image24(GckVisualInfo * visinfo,
guchar * RGB_data,
GdkImage * image,
int width, int height)
{
guchar *imagedata;
int xcnt, ycnt, diffx;
@ -1739,12 +1826,42 @@ void gck_rgb_to_image24(GckVisualInfo * visinfo,
/* RGB to RGBX */
/***************/
GdkColor *gck_rgb_to_color32(GckVisualInfo * visinfo, guchar r, guchar g, guchar b)
/*
* Non-reentrant function - GdkColor is a static storage
*/
static GdkColor *
gck_rgb_to_color32(GckVisualInfo * visinfo, guchar r, guchar g, guchar b)
{
static GdkColor color;
guint32 red, green, blue;
g_function_enter("gck_rgb_to_color32");
g_assert(visinfo!=NULL);
color.red = ((guint16) r) << 8;
color.green = ((guint16) g) << 8;
color.blue = ((guint16) b) << 8;
red = ((guint32) r) << 8;
green = ((guint32) g) << 16;
blue = ((guint32) b) << 24;
color.pixel = red | green | blue;
g_function_leave("gck_rgb_to_color32");
return (&color);
}
/*
* Reentrant function - GdkColor will be malloc'ed
*/
static GdkColor *
gck_rgb_to_color32_r(GckVisualInfo * visinfo, guchar r, guchar g, guchar b)
{
guint32 red, green, blue;
GdkColor *color;
g_function_enter("gck_rgb_to_color32");
g_function_enter("gck_rgb_to_color32_r");
g_assert(visinfo!=NULL);
color=(GdkColor *)malloc(sizeof(GdkColor));
@ -1761,14 +1878,15 @@ GdkColor *gck_rgb_to_color32(GckVisualInfo * visinfo, guchar r, guchar g, guchar
color->pixel = red | green | blue;
g_function_leave("gck_rgb_to_color32");
g_function_leave("gck_rgb_to_color32_r");
return (color);
}
void gck_rgb_to_image32(GckVisualInfo * visinfo,
guchar * RGB_data,
GdkImage * image,
int width, int height)
static void
gck_rgb_to_image32(GckVisualInfo * visinfo,
guchar * RGB_data,
GdkImage * image,
int width, int height)
{
guint32 *imagedata, pixel, r, g, b;
int xcnt, ycnt, diffx=0;
@ -1867,6 +1985,9 @@ void gck_rgb_to_gdkimage(GckVisualInfo * visinfo,
g_function_leave("gck_rgb_to_gdkimage");
}
/*
* Non-reentrant function - GdkColor is a static storage
*/
GdkColor *gck_rgb_to_gdkcolor(GckVisualInfo * visinfo, guchar r, guchar g, guchar b)
{
GdkColor *color=NULL;
@ -1914,6 +2035,56 @@ GdkColor *gck_rgb_to_gdkcolor(GckVisualInfo * visinfo, guchar r, guchar g, gucha
return (color);
}
/*
* Reentrant function - GdkColor will be malloc'ed
*/
GdkColor *gck_rgb_to_gdkcolor_r(GckVisualInfo * visinfo, guchar r, guchar g, guchar b)
{
GdkColor *color=NULL;
g_function_enter("gck_rgb_to_gdkcolor_r");
g_assert(visinfo!=NULL);
if (visinfo->visual->type == GDK_VISUAL_PSEUDO_COLOR)
{
if (visinfo->visual->depth == 8)
{
/* Standard 256 color display */
/* ========================== */
color=gck_rgb_to_color8_r(visinfo, r, g, b);
}
}
else if (visinfo->visual->type == GDK_VISUAL_TRUE_COLOR ||
visinfo->visual->type == GDK_VISUAL_DIRECT_COLOR)
{
if (visinfo->visual->depth == 15 || visinfo->visual->depth == 16)
{
/* HiColor modes */
/* ============= */
color=gck_rgb_to_color16_r(visinfo, r, g, b);
}
else if (visinfo->visual->depth == 24)
{
/* Normal 24 bit mode */
/* ================== */
color=gck_rgb_to_color24_r(visinfo, r, g, b);
}
else if (visinfo->visual->depth == 32)
{
/* 32 bpp mode */
/* =========== */
color=gck_rgb_to_color32_r(visinfo, r, g, b);
}
}
g_function_leave("gck_rgb_to_gdkcolor_r");
return (color);
}
/********************/
/* Color operations */
/********************/

View File

@ -44,8 +44,12 @@ void gck_rgb_to_gdkimage (GckVisualInfo *visinfo,
GdkImage *image,
int width,int height);
/* returns a static storage */
GdkColor *gck_rgb_to_gdkcolor (GckVisualInfo *visinfo,guchar r,guchar g,guchar b);
/* returns a malloc'ed area */
GdkColor *gck_rgb_to_gdkcolor_r (GckVisualInfo *visinfo,guchar r,guchar g,guchar b);
void gck_gc_set_foreground (GckVisualInfo *visinfo,GdkGC *gc,
guchar r, guchar g, guchar b);
void gck_gc_set_background (GckVisualInfo *visinfo,GdkGC *gc,

View File

@ -918,15 +918,15 @@ void ok_button_clicked(GtkWidget *widget, gpointer client_data)
gtk_widget_hide((GtkWidget *)client_data);
gdk_flush();
compute_image();
gtk_widget_destroy((GtkWidget *)client_data);
gtk_main_quit();
}
void cancel_button_clicked(GtkWidget *widget, gpointer client_data)
{
gtk_widget_destroy((GtkWidget *)client_data);
gtk_main_quit();
}
void dialog_destroy(GtkWidget *widget, gpointer client_data)
void dialog_destroy(GtkWidget *widget, GdkEvent *ev, gpointer client_data)
{
gtk_main_quit();
}
@ -989,7 +989,7 @@ void create_main_dialog(void)
gtk_window_set_title(GTK_WINDOW(dialog), "Van Gogh (LIC)");
gtk_window_position(GTK_WINDOW(dialog), GTK_WIN_POS_MOUSE);
gtk_container_border_width(GTK_CONTAINER(dialog), 0);
gtk_signal_connect(GTK_OBJECT(dialog), "destroy",
gtk_signal_connect(GTK_OBJECT(dialog), "delete_event",
(GtkSignalFunc)dialog_destroy, (gpointer)dialog);
hbox = gtk_hbox_new(FALSE,5);

View File

@ -393,7 +393,7 @@ mw_preview_build(GDrawable *drw) {
mwp= mw_preview_build_virgin(drw);
gimp_pixel_rgn_init(&pr, drw, 0, 0, drw->width, drw->height, FALSE, FALSE);
drwBits = (guchar *)malloc(drw->width * drw->bpp);
drwBits = (guchar *)g_malloc(drw->width * drw->bpp);
mwp->bpp = 3;
bc = mwp->bits = (guchar *)malloc(mwp->width*mwp->height*mwp->bpp);
@ -404,7 +404,7 @@ mw_preview_build(GDrawable *drw) {
*bc++=*(drwBits+((gint)(x*mwp->scale)*drw->bpp)+b%drw->bpp);
}
}
free(drwBits);
g_free(drwBits);
return(mwp);
}

View File

@ -2,3 +2,4 @@ Makefile
pm_to_blib
Lib.c
Lib.bs
Config.pm

View File

@ -0,0 +1,5 @@
blib
Makefile
pm_to_blib
perlxsi.c
libperlinterp.bs

View File

@ -0,0 +1,4 @@
Makefile
pm_to_blib
Module.c
Module.bs

View File

@ -37,6 +37,105 @@
* Revision History:
*
* $Log$
* Revision 1.14 1999/04/15 21:48:59 yosh
* * applied gimp-lecorfec-99041[02]-0, changes follow
*
* * plug-ins/FractalExplorer/Dialogs.h (make_color_map):
* replaced free with g_free to fix segfault.
*
* * plug-ins/Lighting/lighting_preview.c (compute_preview):
* allocate xpostab and ypostab only when needed (it could also be
* allocated on stack with a compilation-fixed size like MapObject).
* It avoids to lose some Kb on each preview :)
* Also reindented (unfortunate C-c C-q) some other lines.
*
* * plug-ins/Lighting/lighting_main.c (run):
* release allocated postabs.
*
* * plug-ins/Lighting/lighting_ui.c:
* callbacks now have only one argument because gck widget use
* gtk_signal_connect_object. Caused segfault for scale widget.
*
* * plug-ins/autocrop/autocrop.c (doit):
* return if image has only background (thus fixing a segfault).
*
* * plug-ins/emboss/emboss.c (pluginCore, emboss_do_preview):
* replaced malloc/free with g_malloc/g_free (unneeded, but
* shouldn't everyone use glib calls ? :)
*
* * plug-ins/flame/flame.c :
* replaced a segfaulting free, and several harmless malloc/free pairs.
*
* * plug-ins/flame/megawidget.c (mw_preview_build):
* replaced harmless malloc/free pair.
* Note : mwp->bits is malloc'ed but seems to be never freed.
*
* * plug-ins/fractaltrace/fractaltrace.c (pixels_free):
* replaced a bunch of segfaulting free.
* (pixels_get, dialog_show): replaced gtk_signal_connect_object
* with gtk_signal_connect to accomodate callbacks (caused STRANGE
* dialog behaviour, coz you destroyed buttons one by one).
*
* * plug-ins/illusion/illusion.c (dialog):
* same gtk_signal_connect_object replacement for same reasons.
*
* * plug-ins/libgck/gck/gckcolor.c :
* changed all gck_rgb_to_color* functions to use a static GdkColor
* instead of a malloc'ed area. Provided reentrant functions with
* the old behaviour (gck_rgb_to_color*_r). Made some private functions
* static, too.
* gck_rgb_to_gdkcolor now use the new functions while
* gck_rgb_to_gdkcolor_r is the reentrant version.
* Also affected by this change: gck_gc_set_foreground and
* gck_gc_set_background (no more free(color)).
*
* * plug-ins/libgck/gck/gckcolor.h :
* added the gck_rgb_to_gdkcolor_r proto.
*
* * plug-ins/lic/lic.c (ok_button_clicked, cancel_button_clicked) :
* segfault on gtk_widget_destroy, now calls gtk_main_quit.
* (dialog_destroy) : segfault on window closure when called by
* "destroy" event. Now called by "delete_event".
*
* * plug-ins/megawidget/megawidget.c (mw_preview_build):
* replaced harmless malloc/free pair.
* Note : mwp->bits is malloc'ed but seems to be never freed.
*
* * plug-ins/png/png.c (load_image):
* replaced 2 segfaulting free.
*
* * plug-ins/print/print-ps.c (ps_print):
* replaced a segfaulting free (called many times :).
*
* * plug-ins/sgi/sgi.c (load_image, save_image):
* replaced a bunch of segfaulting free, and did some harmless
* inits to avoid a few gcc warnings.
*
* * plug-ins/wind/wind.c (render_wind):
* replaced a segfaulting free.
* (render_blast): replaced harmless malloc/free pair.
*
* * plug-ins/bmp/bmpread.c (ReadImage):
* yet another free()/g_free() problem fixed.
*
* * plug-ins/exchange/exchange.c (real_exchange):
* ditto.
*
* * plug-ins/fp/fp.h: added Frames_Check_Button_In_A_Box proto.
* * plug-ins/fp/fp_gtk.c: closing subdialogs via window manager
* wasn't handled, thus leading to errors and crashes.
* Now delete_event signals the dialog control button
* to close a dialog with the good way.
*
* * plug-ins/ifscompose/ifscompose.c (value_pair_create):
* tried to set events mask on scale widget (a NO_WINDOW widget).
*
* * plug-ins/png/png.c (save_image):
* Replaced 2 free() with g_free() for g_malloc'ed memory.
* Mysteriously I corrected the loading bug but not the saving one :)
*
* -Yosh
*
* Revision 1.13 1999/01/15 17:34:20 unammx
* 1999-01-15 Federico Mena Quintero <federico@nuclecu.unam.mx>
*
@ -600,8 +699,8 @@ load_image(char *filename) /* I - File to load */
png_read_end(pp, info);
png_read_destroy(pp, info, NULL);
free(pixel);
free(pixels);
g_free(pixel);
g_free(pixels);
free(pp);
free(info);
@ -793,8 +892,8 @@ save_image(char *filename, /* I - File to save to */
png_write_end(pp, info);
png_write_destroy(pp);
free(pixel);
free(pixels);
g_free(pixel);
g_free(pixels);
/*
* Done with the file...

View File

@ -32,6 +32,105 @@
* Revision History:
*
* $Log$
* Revision 1.11 1999/04/15 21:49:01 yosh
* * applied gimp-lecorfec-99041[02]-0, changes follow
*
* * plug-ins/FractalExplorer/Dialogs.h (make_color_map):
* replaced free with g_free to fix segfault.
*
* * plug-ins/Lighting/lighting_preview.c (compute_preview):
* allocate xpostab and ypostab only when needed (it could also be
* allocated on stack with a compilation-fixed size like MapObject).
* It avoids to lose some Kb on each preview :)
* Also reindented (unfortunate C-c C-q) some other lines.
*
* * plug-ins/Lighting/lighting_main.c (run):
* release allocated postabs.
*
* * plug-ins/Lighting/lighting_ui.c:
* callbacks now have only one argument because gck widget use
* gtk_signal_connect_object. Caused segfault for scale widget.
*
* * plug-ins/autocrop/autocrop.c (doit):
* return if image has only background (thus fixing a segfault).
*
* * plug-ins/emboss/emboss.c (pluginCore, emboss_do_preview):
* replaced malloc/free with g_malloc/g_free (unneeded, but
* shouldn't everyone use glib calls ? :)
*
* * plug-ins/flame/flame.c :
* replaced a segfaulting free, and several harmless malloc/free pairs.
*
* * plug-ins/flame/megawidget.c (mw_preview_build):
* replaced harmless malloc/free pair.
* Note : mwp->bits is malloc'ed but seems to be never freed.
*
* * plug-ins/fractaltrace/fractaltrace.c (pixels_free):
* replaced a bunch of segfaulting free.
* (pixels_get, dialog_show): replaced gtk_signal_connect_object
* with gtk_signal_connect to accomodate callbacks (caused STRANGE
* dialog behaviour, coz you destroyed buttons one by one).
*
* * plug-ins/illusion/illusion.c (dialog):
* same gtk_signal_connect_object replacement for same reasons.
*
* * plug-ins/libgck/gck/gckcolor.c :
* changed all gck_rgb_to_color* functions to use a static GdkColor
* instead of a malloc'ed area. Provided reentrant functions with
* the old behaviour (gck_rgb_to_color*_r). Made some private functions
* static, too.
* gck_rgb_to_gdkcolor now use the new functions while
* gck_rgb_to_gdkcolor_r is the reentrant version.
* Also affected by this change: gck_gc_set_foreground and
* gck_gc_set_background (no more free(color)).
*
* * plug-ins/libgck/gck/gckcolor.h :
* added the gck_rgb_to_gdkcolor_r proto.
*
* * plug-ins/lic/lic.c (ok_button_clicked, cancel_button_clicked) :
* segfault on gtk_widget_destroy, now calls gtk_main_quit.
* (dialog_destroy) : segfault on window closure when called by
* "destroy" event. Now called by "delete_event".
*
* * plug-ins/megawidget/megawidget.c (mw_preview_build):
* replaced harmless malloc/free pair.
* Note : mwp->bits is malloc'ed but seems to be never freed.
*
* * plug-ins/png/png.c (load_image):
* replaced 2 segfaulting free.
*
* * plug-ins/print/print-ps.c (ps_print):
* replaced a segfaulting free (called many times :).
*
* * plug-ins/sgi/sgi.c (load_image, save_image):
* replaced a bunch of segfaulting free, and did some harmless
* inits to avoid a few gcc warnings.
*
* * plug-ins/wind/wind.c (render_wind):
* replaced a segfaulting free.
* (render_blast): replaced harmless malloc/free pair.
*
* * plug-ins/bmp/bmpread.c (ReadImage):
* yet another free()/g_free() problem fixed.
*
* * plug-ins/exchange/exchange.c (real_exchange):
* ditto.
*
* * plug-ins/fp/fp.h: added Frames_Check_Button_In_A_Box proto.
* * plug-ins/fp/fp_gtk.c: closing subdialogs via window manager
* wasn't handled, thus leading to errors and crashes.
* Now delete_event signals the dialog control button
* to close a dialog with the good way.
*
* * plug-ins/ifscompose/ifscompose.c (value_pair_create):
* tried to set events mask on scale widget (a NO_WINDOW widget).
*
* * plug-ins/png/png.c (save_image):
* Replaced 2 free() with g_free() for g_malloc'ed memory.
* Mysteriously I corrected the loading bug but not the saving one :)
*
* -Yosh
*
* Revision 1.10 1998/08/28 23:01:46 yosh
* * acconfig.h
* * configure.in
@ -604,7 +703,7 @@ ps_print(int model, /* I - Model (Level 1 or 2) */
for (i = 0; i < num_commands; i ++)
{
fputs(commands[i].command, prn);
free(commands[i].command);
g_free(commands[i].command);
};
fputs("%%EndProlog\n", prn);

View File

@ -46,7 +46,7 @@ DEPS = \
script_fu_DEPENDENCIES = $(DEPS)
CPPFLAGS = \
AM_CPPFLAGS = \
-DREGEX_MALLOC
.PHONY: files

View File

@ -34,6 +34,105 @@
* Revision History:
*
* $Log$
* Revision 1.11 1999/04/15 21:49:06 yosh
* * applied gimp-lecorfec-99041[02]-0, changes follow
*
* * plug-ins/FractalExplorer/Dialogs.h (make_color_map):
* replaced free with g_free to fix segfault.
*
* * plug-ins/Lighting/lighting_preview.c (compute_preview):
* allocate xpostab and ypostab only when needed (it could also be
* allocated on stack with a compilation-fixed size like MapObject).
* It avoids to lose some Kb on each preview :)
* Also reindented (unfortunate C-c C-q) some other lines.
*
* * plug-ins/Lighting/lighting_main.c (run):
* release allocated postabs.
*
* * plug-ins/Lighting/lighting_ui.c:
* callbacks now have only one argument because gck widget use
* gtk_signal_connect_object. Caused segfault for scale widget.
*
* * plug-ins/autocrop/autocrop.c (doit):
* return if image has only background (thus fixing a segfault).
*
* * plug-ins/emboss/emboss.c (pluginCore, emboss_do_preview):
* replaced malloc/free with g_malloc/g_free (unneeded, but
* shouldn't everyone use glib calls ? :)
*
* * plug-ins/flame/flame.c :
* replaced a segfaulting free, and several harmless malloc/free pairs.
*
* * plug-ins/flame/megawidget.c (mw_preview_build):
* replaced harmless malloc/free pair.
* Note : mwp->bits is malloc'ed but seems to be never freed.
*
* * plug-ins/fractaltrace/fractaltrace.c (pixels_free):
* replaced a bunch of segfaulting free.
* (pixels_get, dialog_show): replaced gtk_signal_connect_object
* with gtk_signal_connect to accomodate callbacks (caused STRANGE
* dialog behaviour, coz you destroyed buttons one by one).
*
* * plug-ins/illusion/illusion.c (dialog):
* same gtk_signal_connect_object replacement for same reasons.
*
* * plug-ins/libgck/gck/gckcolor.c :
* changed all gck_rgb_to_color* functions to use a static GdkColor
* instead of a malloc'ed area. Provided reentrant functions with
* the old behaviour (gck_rgb_to_color*_r). Made some private functions
* static, too.
* gck_rgb_to_gdkcolor now use the new functions while
* gck_rgb_to_gdkcolor_r is the reentrant version.
* Also affected by this change: gck_gc_set_foreground and
* gck_gc_set_background (no more free(color)).
*
* * plug-ins/libgck/gck/gckcolor.h :
* added the gck_rgb_to_gdkcolor_r proto.
*
* * plug-ins/lic/lic.c (ok_button_clicked, cancel_button_clicked) :
* segfault on gtk_widget_destroy, now calls gtk_main_quit.
* (dialog_destroy) : segfault on window closure when called by
* "destroy" event. Now called by "delete_event".
*
* * plug-ins/megawidget/megawidget.c (mw_preview_build):
* replaced harmless malloc/free pair.
* Note : mwp->bits is malloc'ed but seems to be never freed.
*
* * plug-ins/png/png.c (load_image):
* replaced 2 segfaulting free.
*
* * plug-ins/print/print-ps.c (ps_print):
* replaced a segfaulting free (called many times :).
*
* * plug-ins/sgi/sgi.c (load_image, save_image):
* replaced a bunch of segfaulting free, and did some harmless
* inits to avoid a few gcc warnings.
*
* * plug-ins/wind/wind.c (render_wind):
* replaced a segfaulting free.
* (render_blast): replaced harmless malloc/free pair.
*
* * plug-ins/bmp/bmpread.c (ReadImage):
* yet another free()/g_free() problem fixed.
*
* * plug-ins/exchange/exchange.c (real_exchange):
* ditto.
*
* * plug-ins/fp/fp.h: added Frames_Check_Button_In_A_Box proto.
* * plug-ins/fp/fp_gtk.c: closing subdialogs via window manager
* wasn't handled, thus leading to errors and crashes.
* Now delete_event signals the dialog control button
* to close a dialog with the good way.
*
* * plug-ins/ifscompose/ifscompose.c (value_pair_create):
* tried to set events mask on scale widget (a NO_WINDOW widget).
*
* * plug-ins/png/png.c (save_image):
* Replaced 2 free() with g_free() for g_malloc'ed memory.
* Mysteriously I corrected the loading bug but not the saving one :)
*
* -Yosh
*
* Revision 1.10 1999/01/15 17:34:37 unammx
* 1999-01-15 Federico Mena Quintero <federico@nuclecu.unam.mx>
*
@ -333,7 +432,8 @@ load_image(char *filename) /* I - File to load */
/*
* Get the image dimensions and create the image...
*/
image_type = 0; /* shut up warnings */
layer_type = 0;
switch (sgip->zsize)
{
case 1 : /* Grayscale */
@ -455,10 +555,10 @@ load_image(char *filename) /* I - File to load */
sgiClose(sgip);
free(pixel);
free(pixels);
free(rows[0]);
free(rows);
g_free(pixel);
g_free(pixels);
g_free(rows[0]);
g_free(rows);
/*
* Update the display...
@ -507,6 +607,7 @@ save_image(char *filename, /* I - File to save to */
gimp_pixel_rgn_init(&pixel_rgn, drawable, 0, 0, drawable->width,
drawable->height, FALSE, FALSE);
zsize = 0;
switch (gimp_drawable_type(drawable_ID))
{
case GRAY_IMAGE :
@ -599,10 +700,10 @@ save_image(char *filename, /* I - File to save to */
sgiClose(sgip);
free(pixel);
free(pixels);
free(rows[0]);
free(rows);
g_free(pixel);
g_free(pixels);
g_free(rows[0]);
g_free(rows);
return (1);
}

View File

@ -273,7 +273,7 @@ render_blast(GDrawable *drawable, gint threshold, gint strength,
gimp_pixel_rgn_init(&src_region, drawable, 0, 0, width, height, FALSE, FALSE);
gimp_pixel_rgn_init(&dest_region, drawable, 0, 0, width, height, TRUE, TRUE);
buffer = malloc(row_stride);
buffer = (guchar *)g_malloc(row_stride);
for (row = y1; row < y2; row++)
{
@ -307,7 +307,7 @@ render_blast(GDrawable *drawable, gint threshold, gint strength,
marker = 0;
}
} /* for */
free(buffer);
g_free(buffer);
/* update the region */
gimp_drawable_flush(drawable);
@ -355,7 +355,7 @@ render_wind(GDrawable *drawable, gint threshold, gint strength,
gimp_pixel_rgn_set_row(&dest_region, sb, x1, row, width);
gimp_progress_update((gdouble) row / (gdouble) (y2 - y1));
}
free(sb);
g_free(sb);
gimp_drawable_flush(drawable);
gimp_drawable_merge_shadow(drawable->id, TRUE);
gimp_drawable_update(drawable->id, x1, y1, x2 - x1, y2 - y1);