[gimp] Make sure items passed as "parent" are actually group items
- From: Michael Natterer <mitch src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gimp] Make sure items passed as "parent" are actually group items
- Date: Mon, 10 Aug 2009 10:14:11 +0000 (UTC)
commit dc53e8170502d710b3a429a182851fbd5f250772
Author: Michael Natterer <mitch gimp org>
Date: Fri Aug 7 10:14:11 2009 +0200
Make sure items passed as "parent" are actually group items
Add precondition checks to all image add() and reorder() functions
app/core/gimpimage.c | 24 ++++++++++++++++++++++++
1 files changed, 24 insertions(+), 0 deletions(-)
---
diff --git a/app/core/gimpimage.c b/app/core/gimpimage.c
index b1d3082..f1e0d3a 100644
--- a/app/core/gimpimage.c
+++ b/app/core/gimpimage.c
@@ -3059,6 +3059,10 @@ gimp_image_add_layer (GimpImage *image,
parent == GIMP_IMAGE_ACTIVE_PARENT ||
gimp_item_get_image (GIMP_ITEM (parent)) == image,
FALSE);
+ g_return_val_if_fail (parent == NULL ||
+ parent == GIMP_IMAGE_ACTIVE_PARENT ||
+ gimp_viewable_get_children (GIMP_VIEWABLE (parent)),
+ FALSE);
active_layer = gimp_image_get_active_layer (image);
@@ -3261,6 +3265,9 @@ gimp_image_add_layers (GimpImage *image,
g_return_if_fail (parent == NULL ||
parent == GIMP_IMAGE_ACTIVE_PARENT ||
gimp_item_get_image (GIMP_ITEM (parent)) == image);
+ g_return_if_fail (parent == NULL ||
+ parent == GIMP_IMAGE_ACTIVE_PARENT ||
+ gimp_viewable_get_children (GIMP_VIEWABLE (parent)));
active_layer = gimp_image_get_active_layer (image);
@@ -3426,6 +3433,9 @@ gimp_image_reorder_layer (GimpImage *image,
g_return_val_if_fail (new_parent == NULL ||
gimp_item_get_image (GIMP_ITEM (new_parent)) == image,
FALSE);
+ g_return_val_if_fail (new_parent == NULL ||
+ gimp_viewable_get_children (GIMP_VIEWABLE (new_parent)),
+ FALSE);
container = gimp_item_get_container (GIMP_ITEM (layer));
@@ -3487,6 +3497,10 @@ gimp_image_add_channel (GimpImage *image,
parent == GIMP_IMAGE_ACTIVE_PARENT ||
gimp_item_get_image (GIMP_ITEM (parent)) == image,
FALSE);
+ g_return_val_if_fail (parent == NULL ||
+ parent == GIMP_IMAGE_ACTIVE_PARENT ||
+ gimp_viewable_get_children (GIMP_VIEWABLE (parent)),
+ FALSE);
active_channel = gimp_image_get_active_channel (image);
@@ -3729,6 +3743,9 @@ gimp_image_reorder_channel (GimpImage *image,
g_return_val_if_fail (new_parent == NULL ||
gimp_item_get_image (GIMP_ITEM (new_parent)) == image,
FALSE);
+ g_return_val_if_fail (new_parent == NULL ||
+ gimp_viewable_get_children (GIMP_VIEWABLE (new_parent)),
+ FALSE);
container = gimp_item_get_container (GIMP_ITEM (channel));
@@ -3790,6 +3807,10 @@ gimp_image_add_vectors (GimpImage *image,
parent == GIMP_IMAGE_ACTIVE_PARENT ||
gimp_item_get_image (GIMP_ITEM (parent)) == image,
FALSE);
+ g_return_val_if_fail (parent == NULL ||
+ parent == GIMP_IMAGE_ACTIVE_PARENT ||
+ gimp_viewable_get_children (GIMP_VIEWABLE (parent)),
+ FALSE);
active_vectors = gimp_image_get_active_vectors (image);
@@ -4006,6 +4027,9 @@ gimp_image_reorder_vectors (GimpImage *image,
g_return_val_if_fail (new_parent == NULL ||
gimp_item_get_image (GIMP_ITEM (new_parent)) == image,
FALSE);
+ g_return_val_if_fail (new_parent == NULL ||
+ gimp_viewable_get_children (GIMP_VIEWABLE (new_parent)),
+ FALSE);
container = gimp_item_get_container (GIMP_ITEM (vectors));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]