From e0fcfc8cc11724ecf2922a7c6b481c58c38239c8 Mon Sep 17 00:00:00 2001 From: EDT 1998 Matthew Wilson Date: Sat, 2 May 1998 19:43:20 +0000 Subject: [PATCH] check to be sure that the gimage still exists when editing a channel - Sat May 2 15:20:54 EDT 1998 Matthew Wilson * app/channels_dialog.c: check to be sure that the gimage still exists when editing a channel - fixes bug report from Sven --Matt --- ChangeLog | 5 +++++ app/channels_dialog.c | 43 +++++++++++++++++++++------------------ app/gui/channels-dialog.c | 43 +++++++++++++++++++++------------------ 3 files changed, 51 insertions(+), 40 deletions(-) diff --git a/ChangeLog b/ChangeLog index fa8c4090cf..3b04aa5e6c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Sat May 2 15:20:54 EDT 1998 Matthew Wilson + + * app/channels_dialog.c: check to be sure that the gimage still + exists when editing a channel - fixes bug report from Sven + Sat May 2 00:59:23 PDT 1998 Manish Singh * gimp.1: spelling corrections from Tamito Kajiyama diff --git a/app/channels_dialog.c b/app/channels_dialog.c index 23e2c3e61e..8e0c0d1971 100644 --- a/app/channels_dialog.c +++ b/app/channels_dialog.c @@ -1890,30 +1890,33 @@ edit_channel_query_ok_callback (GtkWidget *w, channel = options->channel_widget->channel; opacity = (int) (255 * options->opacity) / 100; - /* Set the new channel name */ - if (GIMP_DRAWABLE(channel)->name) - g_free (GIMP_DRAWABLE(channel)->name); - GIMP_DRAWABLE(channel)->name = g_strdup (gtk_entry_get_text (GTK_ENTRY (options->name_entry))); - gtk_label_set (GTK_LABEL (options->channel_widget->label), GIMP_DRAWABLE(channel)->name); - if (channel->opacity != opacity) - { - channel->opacity = opacity; - update = TRUE; - } - for (i = 0; i < 3; i++) - if (options->color_panel->color[i] != channel->col[i]) + if (gimage_get_ID (options->channel_widget->ID)) { + + /* Set the new channel name */ + if (GIMP_DRAWABLE(channel)->name) + g_free (GIMP_DRAWABLE(channel)->name); + GIMP_DRAWABLE(channel)->name = g_strdup (gtk_entry_get_text (GTK_ENTRY (options->name_entry))); + gtk_label_set (GTK_LABEL (options->channel_widget->label), GIMP_DRAWABLE(channel)->name); + + if (channel->opacity != opacity) { - channel->col[i] = options->color_panel->color[i]; + channel->opacity = opacity; update = TRUE; } - - if (update) - { - drawable_update (GIMP_DRAWABLE(channel), 0, 0, GIMP_DRAWABLE(channel)->width, GIMP_DRAWABLE(channel)->height); - gdisplays_flush (); - } - + for (i = 0; i < 3; i++) + if (options->color_panel->color[i] != channel->col[i]) + { + channel->col[i] = options->color_panel->color[i]; + update = TRUE; + } + + if (update) + { + drawable_update (GIMP_DRAWABLE(channel), 0, 0, GIMP_DRAWABLE(channel)->width, GIMP_DRAWABLE(channel)->height); + gdisplays_flush (); + } + } color_panel_free (options->color_panel); gtk_widget_destroy (options->query_box); g_free (options); diff --git a/app/gui/channels-dialog.c b/app/gui/channels-dialog.c index 23e2c3e61e..8e0c0d1971 100644 --- a/app/gui/channels-dialog.c +++ b/app/gui/channels-dialog.c @@ -1890,30 +1890,33 @@ edit_channel_query_ok_callback (GtkWidget *w, channel = options->channel_widget->channel; opacity = (int) (255 * options->opacity) / 100; - /* Set the new channel name */ - if (GIMP_DRAWABLE(channel)->name) - g_free (GIMP_DRAWABLE(channel)->name); - GIMP_DRAWABLE(channel)->name = g_strdup (gtk_entry_get_text (GTK_ENTRY (options->name_entry))); - gtk_label_set (GTK_LABEL (options->channel_widget->label), GIMP_DRAWABLE(channel)->name); - if (channel->opacity != opacity) - { - channel->opacity = opacity; - update = TRUE; - } - for (i = 0; i < 3; i++) - if (options->color_panel->color[i] != channel->col[i]) + if (gimage_get_ID (options->channel_widget->ID)) { + + /* Set the new channel name */ + if (GIMP_DRAWABLE(channel)->name) + g_free (GIMP_DRAWABLE(channel)->name); + GIMP_DRAWABLE(channel)->name = g_strdup (gtk_entry_get_text (GTK_ENTRY (options->name_entry))); + gtk_label_set (GTK_LABEL (options->channel_widget->label), GIMP_DRAWABLE(channel)->name); + + if (channel->opacity != opacity) { - channel->col[i] = options->color_panel->color[i]; + channel->opacity = opacity; update = TRUE; } - - if (update) - { - drawable_update (GIMP_DRAWABLE(channel), 0, 0, GIMP_DRAWABLE(channel)->width, GIMP_DRAWABLE(channel)->height); - gdisplays_flush (); - } - + for (i = 0; i < 3; i++) + if (options->color_panel->color[i] != channel->col[i]) + { + channel->col[i] = options->color_panel->color[i]; + update = TRUE; + } + + if (update) + { + drawable_update (GIMP_DRAWABLE(channel), 0, 0, GIMP_DRAWABLE(channel)->width, GIMP_DRAWABLE(channel)->height); + gdisplays_flush (); + } + } color_panel_free (options->color_panel); gtk_widget_destroy (options->query_box); g_free (options);