network: Fix disconnecting the VPN connection_removed_cb handler

The disconnect was for the wrong object (connection rather than client).
Fix this by simply moving to use g_signal_connect_object which obsoletes
the explicit disconnect calls.
This commit is contained in:
Benjamin Berg 2018-05-24 18:14:50 +02:00
parent 52034ba0be
commit 77a1225917

View file

@ -112,14 +112,14 @@ net_vpn_set_connection (NetVpn *vpn, NMConnection *connection)
priv->connection = g_object_ref (connection); priv->connection = g_object_ref (connection);
client = net_object_get_client (NET_OBJECT (vpn)); client = net_object_get_client (NET_OBJECT (vpn));
g_signal_connect (client, g_signal_connect_object (client,
NM_CLIENT_CONNECTION_REMOVED, NM_CLIENT_CONNECTION_REMOVED,
G_CALLBACK (connection_removed_cb), G_CALLBACK (connection_removed_cb),
vpn); vpn, 0);
g_signal_connect (connection, g_signal_connect_object (connection,
NM_CONNECTION_CHANGED, NM_CONNECTION_CHANGED,
G_CALLBACK (connection_changed_cb), G_CALLBACK (connection_changed_cb),
vpn); vpn, 0);
priv->service_type = net_vpn_connection_to_type (priv->connection); priv->service_type = net_vpn_connection_to_type (priv->connection);
} }
@ -384,12 +384,6 @@ net_vpn_finalize (GObject *object)
g_object_unref (priv->active_connection); g_object_unref (priv->active_connection);
} }
g_signal_handlers_disconnect_by_func (priv->connection,
connection_removed_cb,
vpn);
g_signal_handlers_disconnect_by_func (priv->connection,
connection_changed_cb,
vpn);
g_object_unref (priv->connection); g_object_unref (priv->connection);
g_free (priv->service_type); g_free (priv->service_type);