Commit a3c49547 authored by scott's avatar scott
Browse files

Added safety code for add channel so you can't add a channel twice or

to the wrong image.  (Same thing as I did for layers a few months
ago.)
--sg
parent 9c15ca2b
Wed Jan 28 13:17:06 1998 Scott Goehring <scott@poverty.bloomington.in.us>
* app/gimage.c (gimage_add_channel): Added safety code for add
channel so you can't add a channel twice or to the wrong image.
(Same thing as I did for layers a few months ago.)
Tue Jan 27 22:31:00 PST 1998 Raph Levien <raph@acm.org>
* app/gimage_mask.c: hacked around fractional pixel errors in
......
......@@ -2401,6 +2401,27 @@ gimage_add_channel (GImage *gimage, Channel *channel, int position)
{
ChannelUndo * cu;
if (GIMP_DRAWABLE(channel)->gimage_ID != 0 &&
GIMP_DRAWABLE(channel)->gimage_ID != gimage->ID)
{
warning("gimage_add_channel: attempt to add channel to wrong image");
return NULL;
}
{
link_ptr cc = gimage->channels;
while (cc)
{
if (cc->data == channel)
{
warning("gimage_add_channel: trying to add channel to image twice");
return NULL;
}
cc = next_item(cc);
}
}
/* Prepare a channel undo and push it */
cu = (ChannelUndo *) g_malloc (sizeof (ChannelUndo));
cu->channel = channel;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment