[gimp/gimp-2-6] Bug 601891 - gimp_image_get_selection returns None



commit f05ea433536399963fb493c30f27c928259a21d8
Author: Sven Neumann <sven gimp org>
Date:   Sat Nov 14 16:50:42 2009 +0100

    Bug 601891 -  gimp_image_get_selection returns None
    
    The code used to make the assumption that the selection mask was
    a layer. Actually it is a channel and changing the code accordingly
    fixes the reported problem.
    (cherry picked from commit 474b5fdff3b0bb39f252e67f7ead6357e6f69007)

 plug-ins/pygimp/pygimp-pdb.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/plug-ins/pygimp/pygimp-pdb.c b/plug-ins/pygimp/pygimp-pdb.c
index 06852ad..edcb697 100644
--- a/plug-ins/pygimp/pygimp-pdb.c
+++ b/plug-ins/pygimp/pygimp-pdb.c
@@ -285,7 +285,7 @@ pygimp_param_to_tuple(int nparams, const GimpParam *params)
 	    value = pygimp_drawable_new(NULL, params[i].data.d_drawable);
 	    break;
 	case GIMP_PDB_SELECTION:
-	    value = pygimp_layer_new(params[i].data.d_selection);
+	    value = pygimp_channel_new(params[i].data.d_selection);
 	    break;
 	case GIMP_PDB_COLORARRAY:
 	    if (params[i].data.d_colorarray == NULL) {
@@ -539,8 +539,12 @@ pygimp_param_from_tuple(PyObject *args, const GimpParamDef *ptype, int nparams)
 	    ret[i].data.d_channel = ((PyGimpDrawable *)item)->ID;
 	    break;
 	case GIMP_PDB_SELECTION:
-	    check(!pygimp_layer_check(item));
-	    ret[i].data.d_selection = ((PyGimpLayer *)item)->ID;
+	    if (item == Py_None) {
+		ret[i].data.d_channel = -1;
+		break;
+	    }
+	    check(!pygimp_channel_check(item));
+	    ret[i].data.d_selection = ((PyGimpChannel *)item)->ID;
 	    break;
 	case GIMP_PDB_COLORARRAY:
 	    {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]