[gimp/gimp-2-8] Bug 729158 - Internal inconsistent state with gimp_image_get_selection...
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gimp-2-8] Bug 729158 - Internal inconsistent state with gimp_image_get_selection...
- Date: Tue, 29 Apr 2014 07:20:08 +0000 (UTC)
commit ebdd761caeabb48d83fd3aa6cabfa6878553d9e2
Author: Michael Natterer <mitch gimp org>
Date: Tue Apr 29 09:16:19 2014 +0200
Bug 729158 - Internal inconsistent state with gimp_image_get_selection...
+ gimp_channel_copy
Make gimp-channel-copy always return a GimpChannel, and fail the
prodecure if the input channel is not of image size.
(cherry picked from commit bcce8c95ec7e5df9b38bf44d2d22a03ed2b3a208)
app/pdb/channel-cmds.c | 18 ++++++++++++++----
tools/pdbgen/pdb/channel.pdb | 18 ++++++++++++++----
2 files changed, 28 insertions(+), 8 deletions(-)
---
diff --git a/app/pdb/channel-cmds.c b/app/pdb/channel-cmds.c
index 59b2102..5b45296 100644
--- a/app/pdb/channel-cmds.c
+++ b/app/pdb/channel-cmds.c
@@ -142,10 +142,20 @@ channel_copy_invoker (GimpProcedure *procedure,
if (success)
{
- channel_copy = GIMP_CHANNEL (gimp_item_duplicate (GIMP_ITEM (channel),
- G_TYPE_FROM_INSTANCE (channel)));
-
- if (! channel_copy)
+ GimpImage *image = gimp_item_get_image (GIMP_ITEM (channel));
+ gint width = gimp_image_get_width (image);
+ gint height = gimp_image_get_height (image);
+
+ if (gimp_item_get_width (GIMP_ITEM (channel)) == width &&
+ gimp_item_get_height (GIMP_ITEM (channel)) == height)
+ {
+ channel_copy = GIMP_CHANNEL (gimp_item_duplicate (GIMP_ITEM (channel),
+ GIMP_TYPE_CHANNEL));
+
+ if (! channel_copy)
+ success = FALSE;
+ }
+ else
success = FALSE;
}
diff --git a/tools/pdbgen/pdb/channel.pdb b/tools/pdbgen/pdb/channel.pdb
index 6c0d8f5..aa2a6ba 100644
--- a/tools/pdbgen/pdb/channel.pdb
+++ b/tools/pdbgen/pdb/channel.pdb
@@ -89,10 +89,20 @@ HELP
%invoke = (
code => <<'CODE'
{
- channel_copy = GIMP_CHANNEL (gimp_item_duplicate (GIMP_ITEM (channel),
- G_TYPE_FROM_INSTANCE (channel)));
-
- if (! channel_copy)
+ GimpImage *image = gimp_item_get_image (GIMP_ITEM (channel));
+ gint width = gimp_image_get_width (image);
+ gint height = gimp_image_get_height (image);
+
+ if (gimp_item_get_width (GIMP_ITEM (channel)) == width &&
+ gimp_item_get_height (GIMP_ITEM (channel)) == height)
+ {
+ channel_copy = GIMP_CHANNEL (gimp_item_duplicate (GIMP_ITEM (channel),
+ GIMP_TYPE_CHANNEL));
+
+ if (! channel_copy)
+ success = FALSE;
+ }
+ else
success = FALSE;
}
CODE
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]