diff options
author | Simon Feltman <sfeltman@src.gnome.org> | 2014-05-05 19:42:59 -0700 |
---|---|---|
committer | Simon Feltman <sfeltman@src.gnome.org> | 2014-05-05 20:24:32 -0700 |
commit | 31ecd935564984068e6646676392122bdc03e42e (patch) | |
tree | 27bd4b69f8ed6afc24015d5a3e8939eda738b96e /gi/pygi-foreign.c | |
parent | def47144b63a1492ebf47a4eadb535f45253ff3a (diff) | |
download | pygobject-31ecd935564984068e6646676392122bdc03e42e.tar.gz |
Initialize the foreign API at PyGI load time
Initialize the foreign struct list at gi._gi module load time. This ensures
we always have a valid (non-null) list of foreign marshalers outside of the
context of marshaling.
https://bugzilla.gnome.org/show_bug.cgi?id=694604
Diffstat (limited to 'gi/pygi-foreign.c')
-rw-r--r-- | gi/pygi-foreign.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/gi/pygi-foreign.c b/gi/pygi-foreign.c index 6e0bf79d..8a83c351 100644 --- a/gi/pygi-foreign.c +++ b/gi/pygi-foreign.c @@ -70,10 +70,6 @@ pygi_struct_foreign_lookup (GIBaseInfo *base_info) const gchar *namespace = g_base_info_get_namespace (base_info); const gchar *name = g_base_info_get_name (base_info); - if (foreign_structs == NULL) { - init_foreign_structs (); - } - result = do_lookup (namespace, name); if (result == NULL) { @@ -166,3 +162,11 @@ pygi_register_foreign_struct (const char* namespace_, g_ptr_array_add (foreign_structs, new_struct); } + +void +pygi_foreign_init (void) +{ + if (foreign_structs == NULL) { + init_foreign_structs (); + } +} |