Blob Blame History Raw
From d6ab6476e0986340ea43c1383ff8153ac224a4c9 Mon Sep 17 00:00:00 2001
From: Scott James Remnant <scott@netsplit.com>
Date: Thu, 24 Apr 2008 16:02:11 +0100
Subject: [PATCH] 	* dbus/dbus-connection.c (_dbus_connection_read_write_dispatch):
 	Reference the D-Bus connection during the function call since we
 	call other functions that may free the last reference and we
 	still expect to be able to check the connection after they return
 	to decide our own return value.

---
 dbus/dbus-connection.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/dbus/dbus-connection.c b/dbus/dbus-connection.c
index 5b25534..517deac 100644
--- a/dbus/dbus-connection.c
+++ b/dbus/dbus-connection.c
@@ -3410,6 +3410,8 @@ _dbus_connection_read_write_dispatch (DBusConnection *connection,
 {
   DBusDispatchStatus dstatus;
   dbus_bool_t no_progress_possible;
+
+  dbus_connection_ref (connection);
   
   dstatus = dbus_connection_get_dispatch_status (connection);
 
@@ -3450,6 +3452,7 @@ _dbus_connection_read_write_dispatch (DBusConnection *connection,
   else
     no_progress_possible = _dbus_connection_get_is_connected_unlocked (connection);
   CONNECTION_UNLOCK (connection);
+  dbus_connection_unref (connection);
   return !no_progress_possible; /* TRUE if we can make more progress */
 }
 
-- 
1.5.4.3