[gimp] libgimp: GValue of type GEnum not possible.



commit 84ff060ffac7e15e8793b09a0fd479592573213c
Author: Jehan <jehan girinstud io>
Date:   Tue Jul 30 17:29:55 2019 +0200

    libgimp: GValue of type GEnum not possible.
    
    This fixes such warning:
    > Warning: gvalue.c:188: cannot initialize GValue with type 'GEnum',
    > this type is abstract with regards to GValue use, use a more specific
    > (derived) type
    
    And obviously all subsequent errors because we failed to initialize and
    set enum values. Such as:
    
    > Warning: g_value_set_enum: assertion 'G_VALUE_HOLDS_ENUM (value)' failed
    
    I have only fixed this in gimp_image_pdb. If enum types are used in
    other places with GimpValueArray, we must fix them the same way.

 libgimp/gimpimage_pdb.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
---
diff --git a/libgimp/gimpimage_pdb.c b/libgimp/gimpimage_pdb.c
index 21547b8139..c54470b7dd 100644
--- a/libgimp/gimpimage_pdb.c
+++ b/libgimp/gimpimage_pdb.c
@@ -140,7 +140,7 @@ gimp_image_new (gint              width,
 
   args = gimp_value_array_new_from_types (GIMP_TYPE_INT32,
                                           GIMP_TYPE_INT32,
-                                          G_TYPE_ENUM,
+                                          gimp_image_base_type_get_type(),
                                           G_TYPE_NONE);
   g_value_set_int (gimp_value_array_index (args, 0), width);
   g_value_set_int (gimp_value_array_index (args, 1), height);
@@ -189,8 +189,8 @@ gimp_image_new_with_precision (gint              width,
 
   args = gimp_value_array_new_from_types (GIMP_TYPE_INT32,
                                           GIMP_TYPE_INT32,
-                                          G_TYPE_ENUM,
-                                          G_TYPE_ENUM,
+                                          gimp_image_base_type_get_type(),
+                                          gimp_precision_get_type(),
                                           G_TYPE_NONE);
   g_value_set_int (gimp_value_array_index (args, 0), width);
   g_value_set_int (gimp_value_array_index (args, 1), height);
@@ -1651,7 +1651,7 @@ gimp_image_merge_visible_layers (gint32        image_ID,
   gint32 layer_ID = -1;
 
   args = gimp_value_array_new_from_types (GIMP_TYPE_IMAGE_ID,
-                                          G_TYPE_ENUM,
+                                          gimp_merge_type_get_type(),
                                           G_TYPE_NONE);
   gimp_value_set_image_id (gimp_value_array_index (args, 0), image_ID);
   g_value_set_enum (gimp_value_array_index (args, 1), merge_type);
@@ -1697,7 +1697,7 @@ gimp_image_merge_down (gint32        image_ID,
 
   args = gimp_value_array_new_from_types (GIMP_TYPE_IMAGE_ID,
                                           GIMP_TYPE_LAYER_ID,
-                                          G_TYPE_ENUM,
+                                          gimp_merge_type_get_type(),
                                           G_TYPE_NONE);
   gimp_value_set_image_id (gimp_value_array_index (args, 0), image_ID);
   gimp_value_set_layer_id (gimp_value_array_index (args, 1), merge_layer_ID);
@@ -2287,7 +2287,7 @@ gimp_image_get_component_active (gint32          image_ID,
   gboolean active = FALSE;
 
   args = gimp_value_array_new_from_types (GIMP_TYPE_IMAGE_ID,
-                                          G_TYPE_ENUM,
+                                          gimp_channel_type_get_type(),
                                           G_TYPE_NONE);
   gimp_value_set_image_id (gimp_value_array_index (args, 0), image_ID);
   g_value_set_enum (gimp_value_array_index (args, 1), component);
@@ -2329,7 +2329,7 @@ gimp_image_set_component_active (gint32          image_ID,
   gboolean success = TRUE;
 
   args = gimp_value_array_new_from_types (GIMP_TYPE_IMAGE_ID,
-                                          G_TYPE_ENUM,
+                                          gimp_channel_type_get_type(),
                                           G_TYPE_BOOLEAN,
                                           G_TYPE_NONE);
   gimp_value_set_image_id (gimp_value_array_index (args, 0), image_ID);
@@ -2371,7 +2371,7 @@ gimp_image_get_component_visible (gint32          image_ID,
   gboolean visible = FALSE;
 
   args = gimp_value_array_new_from_types (GIMP_TYPE_IMAGE_ID,
-                                          G_TYPE_ENUM,
+                                          gimp_channel_type_get_type(),
                                           G_TYPE_NONE);
   gimp_value_set_image_id (gimp_value_array_index (args, 0), image_ID);
   g_value_set_enum (gimp_value_array_index (args, 1), component);
@@ -2413,7 +2413,7 @@ gimp_image_set_component_visible (gint32          image_ID,
   gboolean success = TRUE;
 
   args = gimp_value_array_new_from_types (GIMP_TYPE_IMAGE_ID,
-                                          G_TYPE_ENUM,
+                                          gimp_channel_type_get_type(),
                                           G_TYPE_BOOLEAN,
                                           G_TYPE_NONE);
   gimp_value_set_image_id (gimp_value_array_index (args, 0), image_ID);


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