From 5723ba010ae6c4f807957047e64ba11b424529d6 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Tue, 3 Feb 2015 14:45:31 +0000 Subject: [PATCH 3/8] Drop all prior match rules when becoming a monitor --- bus/connection.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/bus/connection.c b/bus/connection.c index 6477d80..6b18f6f 100644 --- a/bus/connection.c +++ b/bus/connection.c @@ -2732,12 +2732,23 @@ bus_connection_be_monitor (DBusConnection *connection, } } + /* We have now done everything that can fail, so there is no problem + * with doing the irrevocable stuff. */ + _dbus_list_clear (&tmp); bus_context_log (transaction->context, DBUS_SYSTEM_LOG_INFO, "Connection %s (%s) became a monitor.", d->name, d->cached_loginfo_string); + if (d->n_match_rules > 0) + { + BusMatchmaker *mm; + + mm = bus_context_get_matchmaker (d->connections->context); + bus_matchmaker_disconnected (mm, connection); + } + /* flag it as a monitor */ d->link_in_monitors = link; _dbus_list_append_link (&d->connections->monitors, link); -- 2.1.4