mirror of https://github.com/GNOME/gimp.git
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
This commit is contained in:
parent
9c15ca2b09
commit
a3c4954710
|
@ -1,3 +1,9 @@
|
|||
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
|
||||
|
|
21
app/gimage.c
21
app/gimage.c
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue