summaryrefslogtreecommitdiff
path: root/_dbus_bindings/libdbusconn.c
diff options
context:
space:
mode:
authorSimon McVittie <smcv@debian.org>2010-12-02 17:27:34 +0000
committerSimon McVittie <smcv@debian.org>2010-12-02 17:27:34 +0000
commitd3f57baf2a9e5e26e2365313abd2890239b6572a (patch)
treeaf069da129d5b0d17f9dcb294cedc8bd1a607002 /_dbus_bindings/libdbusconn.c
parent56ad64cd14e52b479489549f76343f19e3842139 (diff)
downloaddbus-python-d3f57baf2a9e5e26e2365313abd2890239b6572a.tar.gz
fd.o #23831: make sure to ref types passed to PyModule_AddObject
This avoids these static types wrongly being deallocated. Python implements static types as having one initial reference, which is never meant to be released, but if you get your refcounting wrong they'll be "deallocated" (causing a crash) during Py_Finalize.
Diffstat (limited to '_dbus_bindings/libdbusconn.c')
-rw-r--r--_dbus_bindings/libdbusconn.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/_dbus_bindings/libdbusconn.c b/_dbus_bindings/libdbusconn.c
index 9bd8def..0c87078 100644
--- a/_dbus_bindings/libdbusconn.c
+++ b/_dbus_bindings/libdbusconn.c
@@ -114,6 +114,9 @@ dbus_py_init_libdbus_conn_types(void)
dbus_bool_t
dbus_py_insert_libdbus_conn_types(PyObject *this_module)
{
+ /* PyModule_AddObject steals a ref */
+ Py_INCREF (&DBusPyLibDBusConnection_Type);
+
if (PyModule_AddObject(this_module, "_LibDBusConnection",
(PyObject *)&DBusPyLibDBusConnection_Type) < 0)
return FALSE;