Segfault when using GTK templates
I wrote app which uses GTK templates(set_template, bind_template_callback_full, bind_template_child_full, init_template and get_template_child) for UI generation.
In app runtime callback registered via bind_template_callback_full is causing segfault when invoked second time.
I have digged into binaries of pygobject and found out that when callback called second time closure->function
is null, which cause PyObject_CallObject
to crash.
https://gitlab.gnome.org/GNOME/pygobject/-/blob/master/gi/pygi-closure.c#L548-629
Also I found out that first time when callback is called closure->function
is freed inside _pygi_invoke_closure_clear_py_data
https://gitlab.gnome.org/GNOME/pygobject/-/blob/master/gi/pygi-closure.c#L616-621
What do not understand - is why closure->scope
is set to GI_SCOPE_TYPE_ASYNC
, since I do not use async code in app at all.
Note: Also what I noticed is that callbacks does not receive any arguments.
Some useful info:
- OS: Elementary OS 5.1.3(Ubuntu based)
- Python: 3.7.5
- PyGObject==3.36.0
- and bug works with build from repo(9cdbc56f).