diff options
author | Simon Feltman <sfeltman@src.gnome.org> | 2014-09-07 15:53:35 -0700 |
---|---|---|
committer | Simon Feltman <sfeltman@src.gnome.org> | 2014-09-08 13:57:25 -0700 |
commit | 09161ff690ad37c94668d5d65191f4d84829d41f (patch) | |
tree | 460a02f24de25eff1b66d7367019b867e766d52c /gi/pygi-argument.c | |
parent | 4ebb1f5a4750712bd919a31103ed8c8d6af483b3 (diff) | |
download | pygobject-09161ff690ad37c94668d5d65191f4d84829d41f.tar.gz |
Limit foreign struct checks to GI_INFO_TYPE_STRUCT
Add struct type check before calling g_struct_info_is_foreign().
https://bugzilla.gnome.org/show_bug.cgi?id=736175
Diffstat (limited to 'gi/pygi-argument.c')
-rw-r--r-- | gi/pygi-argument.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/gi/pygi-argument.c b/gi/pygi-argument.c index 3d643fe8..d63520d5 100644 --- a/gi/pygi-argument.c +++ b/gi/pygi-argument.c @@ -1036,6 +1036,8 @@ array_success: { GType g_type; PyObject *py_type; + gboolean is_foreign = (info_type == GI_INFO_TYPE_STRUCT) && + (g_struct_info_is_foreign ((GIStructInfo *) info)); g_type = g_registered_type_info_get_g_type ( (GIRegisteredTypeInfo *) info); py_type = _pygi_type_import_by_gi_info ( (GIBaseInfo *) info); @@ -1055,7 +1057,7 @@ array_success: py_type, transfer, FALSE, /*copy_reference*/ - g_struct_info_is_foreign (info), + is_foreign, g_type_info_is_pointer (type_info)); Py_DECREF (py_type); @@ -1382,6 +1384,8 @@ _pygi_argument_to_object (GIArgument *arg, { PyObject *py_type; GType g_type = g_registered_type_info_get_g_type ( (GIRegisteredTypeInfo *) info); + gboolean is_foreign = (info_type == GI_INFO_TYPE_STRUCT) && + (g_struct_info_is_foreign ((GIStructInfo *) info)); /* Special case variant and none to force loading from py module. */ if (g_type == G_TYPE_VARIANT || g_type == G_TYPE_NONE) { @@ -1396,7 +1400,7 @@ _pygi_argument_to_object (GIArgument *arg, py_type, transfer, FALSE, /*is_allocated*/ - g_struct_info_is_foreign (info)); + is_foreign); Py_XDECREF (py_type); break; @@ -1703,7 +1707,8 @@ _pygi_argument_release (GIArgument *arg, if (direction == GI_DIRECTION_IN && transfer == GI_TRANSFER_NOTHING) { g_closure_unref (arg->v_pointer); } - } else if (g_struct_info_is_foreign ( (GIStructInfo*) info)) { + } else if (info_type == GI_INFO_TYPE_STRUCT && + g_struct_info_is_foreign ((GIStructInfo*) info)) { if (direction == GI_DIRECTION_OUT && transfer == GI_TRANSFER_EVERYTHING) { pygi_struct_foreign_release (info, arg->v_pointer); } |