diff options
author | Arjan Molenaar <gaphor@gmail.com> | 2021-08-03 17:42:59 +0200 |
---|---|---|
committer | Christoph Reiter <reiter.christoph@gmail.com> | 2022-04-24 11:26:42 +0200 |
commit | 4769b8f9214a72fd45b8c73dc4d519e1dd0848ed (patch) | |
tree | c01272726479da718835097c26a5aa297094f23b | |
parent | 7edc361f78a676e95ca3bc7917d3683201e996a7 (diff) | |
download | pygobject-4769b8f9214a72fd45b8c73dc4d519e1dd0848ed.tar.gz |
Add extra safeguard in gimodule
Why does a g_instance_init() function only handle GObjects?
-rw-r--r-- | gi/gimodule.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/gi/gimodule.c b/gi/gimodule.c index fa788121..60f1a961 100644 --- a/gi/gimodule.c +++ b/gi/gimodule.c @@ -1066,11 +1066,15 @@ static void pygobject__g_instance_init(GTypeInstance *instance, gpointer g_class) { - GObject *object = (GObject *) instance; + GObject *object; PyObject *wrapper, *result; PyGILState_STATE state; gboolean needs_init = FALSE; + g_return_if_fail(G_IS_OBJECT(instance)); + + object = (GObject *) instance; + wrapper = g_object_get_qdata(object, pygobject_wrapper_key); if (wrapper == NULL) { wrapper = pygobject_init_wrapper_get(); |