diff options
| author | Simon McVittie <smcv@debian.org> | 2010-12-02 17:27:34 +0000 |
|---|---|---|
| committer | Simon McVittie <smcv@debian.org> | 2010-12-02 17:27:34 +0000 |
| commit | d3f57baf2a9e5e26e2365313abd2890239b6572a (patch) | |
| tree | af069da129d5b0d17f9dcb294cedc8bd1a607002 /_dbus_bindings/mainloop.c | |
| parent | 56ad64cd14e52b479489549f76343f19e3842139 (diff) | |
| download | dbus-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/mainloop.c')
| -rw-r--r-- | _dbus_bindings/mainloop.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/_dbus_bindings/mainloop.c b/_dbus_bindings/mainloop.c index 1733410..710f474 100644 --- a/_dbus_bindings/mainloop.c +++ b/_dbus_bindings/mainloop.c @@ -198,6 +198,8 @@ dbus_py_insert_mainloop_types(PyObject *this_module) NULL); if (!null_main_loop) return 0; + /* PyModule_AddObject steals a ref */ + Py_INCREF (&NativeMainLoop_Type); if (PyModule_AddObject (this_module, "NativeMainLoop", (PyObject *)&NativeMainLoop_Type) < 0) return 0; if (PyModule_AddObject (this_module, "NULL_MAIN_LOOP", |
