mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-04 15:20:28 +01:00
dbus: reinstall property filter on dbus connection changes (rh #918273)
Like if the dbus daemon restarts; in this case the connection has changed and the new connection doesn't have the filter installed, and libdbus aborts when we try to remove a filter that doesn't exist on the connection. Fix that by re-adding the filter when the connection changes.
This commit is contained in:
parent
edd1ebe8a0
commit
bd636ffb40
1 changed files with 26 additions and 0 deletions
|
|
@ -215,6 +215,7 @@ typedef struct {
|
|||
#endif
|
||||
|
||||
NMDBusManager *dbus_mgr;
|
||||
guint dbus_connection_changed_id;
|
||||
NMUdevManager *udev_mgr;
|
||||
NMBluezManager *bluez_mgr;
|
||||
|
||||
|
|
@ -4252,6 +4253,7 @@ dispose (GObject *object)
|
|||
g_assert (dbus_connection);
|
||||
dbus_connection_remove_filter (dbus_connection, prop_filter, manager);
|
||||
}
|
||||
g_signal_handler_disconnect (priv->dbus_mgr, priv->dbus_connection_changed_id);
|
||||
g_object_unref (priv->dbus_mgr);
|
||||
|
||||
if (priv->bluez_mgr)
|
||||
|
|
@ -4498,6 +4500,26 @@ periodic_update_active_connection_timestamps (gpointer user_data)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
dbus_connection_changed_cb (NMDBusManager *dbus_mgr,
|
||||
DBusGConnection *connection,
|
||||
gpointer user_data)
|
||||
{
|
||||
NMManager *self = NM_MANAGER (user_data);
|
||||
DBusConnection *dbus_connection;
|
||||
|
||||
if (connection) {
|
||||
dbus_connection = dbus_g_connection_get_connection (connection);
|
||||
g_assert (dbus_connection);
|
||||
|
||||
/* Register property filter on new connection; there's no reason this
|
||||
* should fail except out-of-memory or program error; if it does fail
|
||||
* then there's no Manager property access control, which is bad.
|
||||
*/
|
||||
g_assert (dbus_connection_add_filter (dbus_connection, prop_filter, self, NULL));
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
nm_manager_init (NMManager *manager)
|
||||
{
|
||||
|
|
@ -4540,6 +4562,10 @@ nm_manager_init (NMManager *manager)
|
|||
priv->state = NM_STATE_DISCONNECTED;
|
||||
|
||||
priv->dbus_mgr = nm_dbus_manager_get ();
|
||||
priv->dbus_connection_changed_id = g_signal_connect (priv->dbus_mgr,
|
||||
NM_DBUS_MANAGER_DBUS_CONNECTION_CHANGED,
|
||||
G_CALLBACK (dbus_connection_changed_cb),
|
||||
manager);
|
||||
|
||||
priv->modem_manager = nm_modem_manager_get ();
|
||||
priv->modem_added_id = g_signal_connect (priv->modem_manager, "modem-added",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue