[patch] [python] conn.c: fix Connection setup in absence of main loop, and error handling

Simon McVittie simon.mcvittie at collabora.co.uk
Tue Jan 16 11:47:39 PST 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Again, in http://people.freedesktop.org/~smcv/git/dbus-python/.git

- From 7d70b07e62d579ce85572a3e1ebb92f42461a185 Mon Sep 17 00:00:00 2001
From: Simon McVittie <simon.mcvittie at collabora.co.uk>
Date: Tue, 16 Jan 2007 19:36:05 +0000
Subject: [PATCH] conn.c: fix Connection setup in absence of main loop, and error handling

* Only set up a main loop if we actually have one (not None)
* Don't double-close the DBusConnection (causing an assertion in libdbus) if
  we somehow fail to set up the main loop. Thanks to tsuraan
  <tsuraan at gmail.com> for the bug report.
- ---
 _dbus_bindings/conn.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/_dbus_bindings/conn.c b/_dbus_bindings/conn.c
index 94951ce..4c623ce 100644
- --- a/_dbus_bindings/conn.c
+++ b/_dbus_bindings/conn.c
@@ -260,8 +260,11 @@ DBusPyConnection_NewConsumingDBusConnection(PyTypeObject *cls,
 
     DBUS_PY_RAISE_VIA_GOTO_IF_FAIL(conn, err);
     self->conn = conn;
+    /* the DBusPyConnection will close it now */
+    conn = NULL;
 
- -    if (!dbus_py_set_up_connection((PyObject *)self, mainloop)) {
+    if (self->has_mainloop
+        && !dbus_py_set_up_connection((PyObject *)self, mainloop)) {
         goto err;
     }
 
- -- 
1.4.4.4

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: OpenPGP key: http://www.pseudorandom.co.uk/2003/contact/ or pgp.net

iD8DBQFFrSvbWSc8zVUw7HYRAq0eAKCVwCOigtFPU35GB27SCaIGark4QQCfQwtH
mXr4+rwAtQH4zravIY3a9kI=
=/gP3
-----END PGP SIGNATURE-----


More information about the dbus mailing list