pass layer_ID instead of layer_widget to rename funtion to prevent

Sun Mar 15 02:06:18 CST 1998  Larry Ewing  <lewing@gimp.org>

	* app/layers_dialog.c: pass layer_ID instead of layer_widget to
	rename funtion to prevent dereferencing freed mem. Fixes layer
	rename bug.
This commit is contained in:
CST 1998 Larry Ewing 1998-03-15 08:15:10 +00:00 committed by Larry Ewing
parent baf7936f54
commit 8497cf6f1a
3 changed files with 40 additions and 34 deletions

View File

@ -1,3 +1,9 @@
Sun Mar 15 02:06:18 CST 1998 Larry Ewing <lewing@gimp.org>
* app/layers_dialog.c: pass layer_ID instead of layer_widget to
rename funtion to prevent dereferencing freed mem. Fixes layer
rename bug.
Sun Mar 15 06:15:37 1998 Tim Janik <timj@gimp.org>
* app/gimage.c (gimage_remove_layer): check whether the removed layer

View File

@ -3081,8 +3081,7 @@ typedef struct _EditLayerOptions EditLayerOptions;
struct _EditLayerOptions {
GtkWidget *query_box;
GtkWidget *name_entry;
LayerWidget *layer_widget;
int layer_ID;
};
static void
@ -3093,8 +3092,9 @@ edit_layer_query_ok_callback (GtkWidget *w,
Layer *layer;
options = (EditLayerOptions *) client_data;
layer = options->layer_widget->layer;
if ((layer = layer_get_ID (options->layer_ID)))
{
/* Set the new layer name */
if (GIMP_DRAWABLE(layer)->name)
{
@ -3102,16 +3102,17 @@ edit_layer_query_ok_callback (GtkWidget *w,
if (layer_is_floating_sel (layer))
{
floating_sel_to_layer (layer);
gdisplays_flush ();
}
g_free (GIMP_DRAWABLE(layer)->name);
}
GIMP_DRAWABLE(layer)->name = g_strdup (gtk_entry_get_text (GTK_ENTRY (options->name_entry)));
gtk_label_set (GTK_LABEL (options->layer_widget->label), GIMP_DRAWABLE(layer)->name);
gtk_widget_draw (options->layer_widget->label, NULL);
}
gdisplays_flush ();
gtk_widget_destroy (options->query_box);
g_free (options);
}
@ -3151,8 +3152,7 @@ layers_dialog_edit_layer_query (LayerWidget *layer_widget)
/* the new options structure */
options = (EditLayerOptions *) g_malloc (sizeof (EditLayerOptions));
options->layer_widget = layer_widget;
options->layer_ID = drawable_ID (GIMP_DRAWABLE (layer_widget->layer));
/* the dialog */
options->query_box = gtk_dialog_new ();
gtk_window_set_wmclass (GTK_WINDOW (options->query_box), "edit_layer_attrributes", "Gimp");

View File

@ -3081,8 +3081,7 @@ typedef struct _EditLayerOptions EditLayerOptions;
struct _EditLayerOptions {
GtkWidget *query_box;
GtkWidget *name_entry;
LayerWidget *layer_widget;
int layer_ID;
};
static void
@ -3093,8 +3092,9 @@ edit_layer_query_ok_callback (GtkWidget *w,
Layer *layer;
options = (EditLayerOptions *) client_data;
layer = options->layer_widget->layer;
if ((layer = layer_get_ID (options->layer_ID)))
{
/* Set the new layer name */
if (GIMP_DRAWABLE(layer)->name)
{
@ -3102,16 +3102,17 @@ edit_layer_query_ok_callback (GtkWidget *w,
if (layer_is_floating_sel (layer))
{
floating_sel_to_layer (layer);
gdisplays_flush ();
}
g_free (GIMP_DRAWABLE(layer)->name);
}
GIMP_DRAWABLE(layer)->name = g_strdup (gtk_entry_get_text (GTK_ENTRY (options->name_entry)));
gtk_label_set (GTK_LABEL (options->layer_widget->label), GIMP_DRAWABLE(layer)->name);
gtk_widget_draw (options->layer_widget->label, NULL);
}
gdisplays_flush ();
gtk_widget_destroy (options->query_box);
g_free (options);
}
@ -3151,8 +3152,7 @@ layers_dialog_edit_layer_query (LayerWidget *layer_widget)
/* the new options structure */
options = (EditLayerOptions *) g_malloc (sizeof (EditLayerOptions));
options->layer_widget = layer_widget;
options->layer_ID = drawable_ID (GIMP_DRAWABLE (layer_widget->layer));
/* the dialog */
options->query_box = gtk_dialog_new ();
gtk_window_set_wmclass (GTK_WINDOW (options->query_box), "edit_layer_attrributes", "Gimp");