Commit 6fc7ce76 authored by Christian Hergert's avatar Christian Hergert

gi: use boxed type for GIBaseInfo

These are full transfer, so we need the gvalue to clean up after
our accesses.
parent c47cbd3b
......@@ -509,7 +509,7 @@ tmpl_expr_getattr_eval (TmplExprGetattr *node,
g_value_init (return_value, TMPL_TYPE_BASE_INFO);
g_value_set_pointer (return_value, base_info);
g_value_take_boxed (return_value, base_info);
ret = TRUE;
......@@ -1608,10 +1608,10 @@ builtin_typeof (const GValue *value,
g_value_init (return_value, G_TYPE_GTYPE);
g_value_get_pointer (value) != NULL &&
GI_IS_REGISTERED_TYPE_INFO (g_value_get_pointer (value)))
g_value_get_boxed (value) != NULL &&
GI_IS_REGISTERED_TYPE_INFO (g_value_get_boxed (value)))
g_value_set_gtype (return_value,
g_registered_type_info_get_g_type (g_value_get_pointer (value)));
g_registered_type_info_get_g_type (g_value_get_boxed (value)));
else if (G_VALUE_HOLDS_OBJECT (value) &&
g_value_get_object (value) != NULL)
g_value_set_gtype (return_value, G_OBJECT_TYPE (g_value_get_object (value)));
......@@ -21,7 +21,11 @@
#include "tmpl-gi-private.h"
G_DEFINE_POINTER_TYPE (TmplTypelib, tmpl_typelib)
G_DEFINE_POINTER_TYPE (TmplBaseInfo, tmpl_base_info)
typedef struct GIBaseInfo TmplBaseInfo;
G_DEFINE_BOXED_TYPE (TmplBaseInfo, tmpl_base_info,
#define return_type_mismatch(value, type) \
......@@ -143,9 +147,9 @@ tmpl_gi_argument_from_g_value (const GValue *value,
arg->v_long = g_value_get_gtype (value);
else if (G_VALUE_HOLDS (value, TMPL_TYPE_BASE_INFO) &&
g_value_get_pointer (value) != NULL &&
GI_IS_REGISTERED_TYPE_INFO (g_value_get_pointer (value)))
arg->v_long = g_registered_type_info_get_g_type (g_value_get_pointer (value));
g_value_get_boxed (value) != NULL &&
GI_IS_REGISTERED_TYPE_INFO (g_value_get_boxed (value)))
arg->v_long = g_registered_type_info_get_g_type (g_value_get_boxed (value));
return_type_mismatch (value, G_TYPE_GTYPE);
return TRUE;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment