[gimp] app: protect against calling a subclass' GimpItem::get_node() impl directly
- From: Michael Natterer <mitch src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gimp] app: protect against calling a subclass' GimpItem::get_node() impl directly
- Date: Sun, 14 Feb 2010 19:28:41 +0000 (UTC)
commit 12aa801441226c7f8f1fa87416f22552b3eec292
Author: Michael Natterer <mitch gimp org>
Date: Sun Feb 14 20:26:16 2010 +0100
app: protect against calling a subclass' GimpItem::get_node() impl directly
gimp_drawable_get_mode_node() was calling gimp_drawable_get_node()
instead of gimp_item_get_node() if the mode_node didn't already exist.
Fortunately that was never the case i nthe current code. Added
warnings in the GimpItem::get_node() impls that would go off in such a
situation.
app/core/gimpchannel.c | 6 ++++++
app/core/gimpdrawable.c | 4 +++-
app/core/gimplayer.c | 2 ++
3 files changed, 11 insertions(+), 1 deletions(-)
---
diff --git a/app/core/gimpchannel.c b/app/core/gimpchannel.c
index 7354976..ca7fd76 100644
--- a/app/core/gimpchannel.c
+++ b/app/core/gimpchannel.c
@@ -851,6 +851,8 @@ gimp_channel_get_node (GimpItem *item)
channel->color.b,
channel->color.a);
+ g_warn_if_fail (channel->color_node == NULL);
+
channel->color_node = gegl_node_new_child (node,
"operation", "gegl:color",
"value", color,
@@ -858,12 +860,16 @@ gimp_channel_get_node (GimpItem *item)
g_object_unref (color);
+ g_warn_if_fail (channel->mask_node == NULL);
+
channel->mask_node = gegl_node_new_child (node,
"operation", "gegl:opacity",
NULL);
gegl_node_connect_to (channel->color_node, "output",
channel->mask_node, "input");
+ g_warn_if_fail (channel->invert_node == NULL);
+
channel->invert_node = gegl_node_new_child (node,
"operation", "gegl:invert",
NULL);
diff --git a/app/core/gimpdrawable.c b/app/core/gimpdrawable.c
index 5818c5b..af7dfe5 100644
--- a/app/core/gimpdrawable.c
+++ b/app/core/gimpdrawable.c
@@ -819,6 +819,8 @@ gimp_drawable_get_node (GimpItem *item)
node = GIMP_ITEM_CLASS (parent_class)->get_node (item);
+ g_warn_if_fail (drawable->private->mode_node == NULL);
+
drawable->private->mode_node = gegl_node_new_child (node,
"operation", "gegl:over",
NULL);
@@ -1533,7 +1535,7 @@ gimp_drawable_get_mode_node (GimpDrawable *drawable)
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL);
if (! drawable->private->mode_node)
- gimp_drawable_get_node (GIMP_ITEM (drawable));
+ gimp_item_get_node (GIMP_ITEM (drawable));
return drawable->private->mode_node;
}
diff --git a/app/core/gimplayer.c b/app/core/gimplayer.c
index fe5892d..a99416f 100644
--- a/app/core/gimplayer.c
+++ b/app/core/gimplayer.c
@@ -761,6 +761,8 @@ gimp_layer_get_node (GimpItem *item)
source = gimp_drawable_get_source_node (drawable);
gegl_node_add_child (node, source);
+ g_warn_if_fail (layer->opacity_node == NULL);
+
layer->opacity_node = gegl_node_new_child (node,
"operation", "gegl:opacity",
"value", layer->opacity,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]