core: convert the DBus manager to a single-ref object
It's created very, very early and never needs to be unrefed by anything except the main() function.
This commit is contained in:

committed by
Dan Winship

parent
e3bd3278e9
commit
04cb58eacd
@@ -229,7 +229,6 @@ nm_bluez_adapter_new (const char *path, NMConnectionProvider *provider)
|
|||||||
{
|
{
|
||||||
NMBluezAdapter *self;
|
NMBluezAdapter *self;
|
||||||
NMBluezAdapterPrivate *priv;
|
NMBluezAdapterPrivate *priv;
|
||||||
NMDBusManager *dbus_mgr;
|
|
||||||
DBusGConnection *connection;
|
DBusGConnection *connection;
|
||||||
|
|
||||||
self = (NMBluezAdapter *) g_object_new (NM_TYPE_BLUEZ_ADAPTER,
|
self = (NMBluezAdapter *) g_object_new (NM_TYPE_BLUEZ_ADAPTER,
|
||||||
@@ -242,14 +241,12 @@ nm_bluez_adapter_new (const char *path, NMConnectionProvider *provider)
|
|||||||
|
|
||||||
priv->provider = provider;
|
priv->provider = provider;
|
||||||
|
|
||||||
dbus_mgr = nm_dbus_manager_get ();
|
connection = nm_dbus_manager_get_connection (nm_dbus_manager_get ());
|
||||||
connection = nm_dbus_manager_get_connection (dbus_mgr);
|
|
||||||
|
|
||||||
priv->proxy = dbus_g_proxy_new_for_name (connection,
|
priv->proxy = dbus_g_proxy_new_for_name (connection,
|
||||||
BLUEZ_SERVICE,
|
BLUEZ_SERVICE,
|
||||||
priv->path,
|
priv->path,
|
||||||
BLUEZ_ADAPTER_INTERFACE);
|
BLUEZ_ADAPTER_INTERFACE);
|
||||||
g_object_unref (dbus_mgr);
|
|
||||||
|
|
||||||
dbus_g_proxy_add_signal (priv->proxy, "DeviceCreated",
|
dbus_g_proxy_add_signal (priv->proxy, "DeviceCreated",
|
||||||
DBUS_TYPE_G_OBJECT_PATH, G_TYPE_INVALID);
|
DBUS_TYPE_G_OBJECT_PATH, G_TYPE_INVALID);
|
||||||
|
@@ -378,7 +378,6 @@ nm_bluez_device_new (const char *path, NMConnectionProvider *provider)
|
|||||||
{
|
{
|
||||||
NMBluezDevice *self;
|
NMBluezDevice *self;
|
||||||
NMBluezDevicePrivate *priv;
|
NMBluezDevicePrivate *priv;
|
||||||
NMDBusManager *dbus_mgr;
|
|
||||||
DBusGConnection *connection;
|
DBusGConnection *connection;
|
||||||
|
|
||||||
g_return_val_if_fail (path != NULL, NULL);
|
g_return_val_if_fail (path != NULL, NULL);
|
||||||
@@ -414,14 +413,12 @@ nm_bluez_device_new (const char *path, NMConnectionProvider *provider)
|
|||||||
G_CALLBACK (cp_connections_loaded),
|
G_CALLBACK (cp_connections_loaded),
|
||||||
self);
|
self);
|
||||||
|
|
||||||
dbus_mgr = nm_dbus_manager_get ();
|
connection = nm_dbus_manager_get_connection (nm_dbus_manager_get ());
|
||||||
connection = nm_dbus_manager_get_connection (dbus_mgr);
|
|
||||||
|
|
||||||
priv->proxy = dbus_g_proxy_new_for_name (connection,
|
priv->proxy = dbus_g_proxy_new_for_name (connection,
|
||||||
BLUEZ_SERVICE,
|
BLUEZ_SERVICE,
|
||||||
priv->path,
|
priv->path,
|
||||||
BLUEZ_DEVICE_INTERFACE);
|
BLUEZ_DEVICE_INTERFACE);
|
||||||
g_object_unref (dbus_mgr);
|
|
||||||
|
|
||||||
dbus_g_object_register_marshaller (g_cclosure_marshal_generic,
|
dbus_g_object_register_marshaller (g_cclosure_marshal_generic,
|
||||||
G_TYPE_NONE,
|
G_TYPE_NONE,
|
||||||
|
@@ -347,7 +347,7 @@ dispose (GObject *object)
|
|||||||
if (priv->dbus_mgr) {
|
if (priv->dbus_mgr) {
|
||||||
g_signal_handlers_disconnect_by_func (priv->dbus_mgr, name_owner_changed_cb, self);
|
g_signal_handlers_disconnect_by_func (priv->dbus_mgr, name_owner_changed_cb, self);
|
||||||
g_signal_handlers_disconnect_by_func (priv->dbus_mgr, dbus_connection_changed_cb, self);
|
g_signal_handlers_disconnect_by_func (priv->dbus_mgr, dbus_connection_changed_cb, self);
|
||||||
g_object_unref (priv->dbus_mgr);
|
priv->dbus_mgr = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
G_OBJECT_CLASS (nm_bluez_manager_parent_class)->dispose (object);
|
G_OBJECT_CLASS (nm_bluez_manager_parent_class)->dispose (object);
|
||||||
|
@@ -1235,7 +1235,7 @@ dispose (GObject *object)
|
|||||||
g_signal_handler_disconnect (priv->dbus_mgr, priv->mm_watch_id);
|
g_signal_handler_disconnect (priv->dbus_mgr, priv->mm_watch_id);
|
||||||
priv->mm_watch_id = 0;
|
priv->mm_watch_id = 0;
|
||||||
}
|
}
|
||||||
g_clear_object (&priv->dbus_mgr);
|
priv->dbus_mgr = NULL;
|
||||||
|
|
||||||
g_clear_object (&priv->type_proxy);
|
g_clear_object (&priv->type_proxy);
|
||||||
g_clear_object (&priv->dev_proxy);
|
g_clear_object (&priv->dev_proxy);
|
||||||
|
@@ -95,7 +95,6 @@ void
|
|||||||
nm_wimax_nsp_export_to_dbus (NMWimaxNsp *self)
|
nm_wimax_nsp_export_to_dbus (NMWimaxNsp *self)
|
||||||
{
|
{
|
||||||
NMWimaxNspPrivate *priv;
|
NMWimaxNspPrivate *priv;
|
||||||
NMDBusManager *mgr;
|
|
||||||
static guint32 counter = 0;
|
static guint32 counter = 0;
|
||||||
|
|
||||||
g_return_if_fail (NM_IS_WIMAX_NSP (self));
|
g_return_if_fail (NM_IS_WIMAX_NSP (self));
|
||||||
@@ -104,10 +103,8 @@ nm_wimax_nsp_export_to_dbus (NMWimaxNsp *self)
|
|||||||
|
|
||||||
g_return_if_fail (priv->dbus_path == NULL);
|
g_return_if_fail (priv->dbus_path == NULL);
|
||||||
|
|
||||||
mgr = nm_dbus_manager_get ();
|
|
||||||
priv->dbus_path = g_strdup_printf (NM_DBUS_PATH_WIMAX_NSP "/%d", counter++);
|
priv->dbus_path = g_strdup_printf (NM_DBUS_PATH_WIMAX_NSP "/%d", counter++);
|
||||||
nm_dbus_manager_register_object (mgr, priv->dbus_path, self);
|
nm_dbus_manager_register_object (nm_dbus_manager_get (), priv->dbus_path, self);
|
||||||
g_object_unref (mgr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
|
@@ -687,7 +687,6 @@ dispose (GObject *object)
|
|||||||
g_signal_handler_disconnect (priv->dbus_mgr, priv->dis_conn_id);
|
g_signal_handler_disconnect (priv->dbus_mgr, priv->dis_conn_id);
|
||||||
priv->dis_conn_id = 0;
|
priv->dis_conn_id = 0;
|
||||||
}
|
}
|
||||||
g_object_unref (priv->dbus_mgr);
|
|
||||||
priv->dbus_mgr = NULL;
|
priv->dbus_mgr = NULL;
|
||||||
|
|
||||||
if (priv->proxies) {
|
if (priv->proxies) {
|
||||||
|
@@ -284,7 +284,7 @@ dispose (GObject *object)
|
|||||||
if (priv->dbus_mgr) {
|
if (priv->dbus_mgr) {
|
||||||
if (priv->name_owner_id)
|
if (priv->name_owner_id)
|
||||||
g_signal_handler_disconnect (priv->dbus_mgr, priv->name_owner_id);
|
g_signal_handler_disconnect (priv->dbus_mgr, priv->name_owner_id);
|
||||||
g_object_unref (G_OBJECT (priv->dbus_mgr));
|
priv->dbus_mgr = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (priv->proxy)
|
if (priv->proxy)
|
||||||
|
@@ -37,7 +37,6 @@ G_DEFINE_TYPE (NMModemGeneric, nm_modem_generic, NM_TYPE_MODEM)
|
|||||||
#define NM_MODEM_GENERIC_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_MODEM_GENERIC, NMModemGenericPrivate))
|
#define NM_MODEM_GENERIC_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_MODEM_GENERIC, NMModemGenericPrivate))
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
NMDBusManager *dbus_mgr;
|
|
||||||
DBusGProxy *proxy;
|
DBusGProxy *proxy;
|
||||||
DBusGProxy *props_proxy;
|
DBusGProxy *props_proxy;
|
||||||
|
|
||||||
@@ -354,9 +353,6 @@ modem_properties_changed (DBusGProxy *proxy,
|
|||||||
static void
|
static void
|
||||||
nm_modem_generic_init (NMModemGeneric *self)
|
nm_modem_generic_init (NMModemGeneric *self)
|
||||||
{
|
{
|
||||||
NMModemGenericPrivate *priv = NM_MODEM_GENERIC_GET_PRIVATE (self);
|
|
||||||
|
|
||||||
priv->dbus_mgr = nm_dbus_manager_get ();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static GObject*
|
static GObject*
|
||||||
@@ -374,7 +370,7 @@ constructor (GType type,
|
|||||||
|
|
||||||
priv = NM_MODEM_GENERIC_GET_PRIVATE (object);
|
priv = NM_MODEM_GENERIC_GET_PRIVATE (object);
|
||||||
|
|
||||||
bus = nm_dbus_manager_get_connection (priv->dbus_mgr);
|
bus = nm_dbus_manager_get_connection (nm_dbus_manager_get ());
|
||||||
priv->proxy = dbus_g_proxy_new_for_name (bus,
|
priv->proxy = dbus_g_proxy_new_for_name (bus,
|
||||||
MM_OLD_DBUS_SERVICE,
|
MM_OLD_DBUS_SERVICE,
|
||||||
nm_modem_get_path (NM_MODEM (object)),
|
nm_modem_get_path (NM_MODEM (object)),
|
||||||
@@ -416,11 +412,6 @@ dispose (GObject *object)
|
|||||||
priv->props_proxy = NULL;
|
priv->props_proxy = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (priv->dbus_mgr) {
|
|
||||||
g_object_unref (priv->dbus_mgr);
|
|
||||||
priv->dbus_mgr = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (nm_modem_generic_parent_class)->dispose (object);
|
G_OBJECT_CLASS (nm_modem_generic_parent_class)->dispose (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -802,10 +802,7 @@ dispose (GObject *object)
|
|||||||
g_hash_table_destroy (self->priv->modems);
|
g_hash_table_destroy (self->priv->modems);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (self->priv->dbus_mgr) {
|
self->priv->dbus_mgr = NULL;
|
||||||
g_object_unref (self->priv->dbus_mgr);
|
|
||||||
self->priv->dbus_mgr = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Chain up to the parent class */
|
/* Chain up to the parent class */
|
||||||
G_OBJECT_CLASS (nm_modem_manager_parent_class)->dispose (object);
|
G_OBJECT_CLASS (nm_modem_manager_parent_class)->dispose (object);
|
||||||
|
@@ -212,13 +212,10 @@ void
|
|||||||
nm_active_connection_export (NMActiveConnection *self)
|
nm_active_connection_export (NMActiveConnection *self)
|
||||||
{
|
{
|
||||||
NMActiveConnectionPrivate *priv = NM_ACTIVE_CONNECTION_GET_PRIVATE (self);
|
NMActiveConnectionPrivate *priv = NM_ACTIVE_CONNECTION_GET_PRIVATE (self);
|
||||||
NMDBusManager *dbus_mgr;
|
|
||||||
static guint32 counter = 0;
|
static guint32 counter = 0;
|
||||||
|
|
||||||
priv->path = g_strdup_printf (NM_DBUS_PATH "/ActiveConnection/%d", counter++);
|
priv->path = g_strdup_printf (NM_DBUS_PATH "/ActiveConnection/%d", counter++);
|
||||||
dbus_mgr = nm_dbus_manager_get ();
|
nm_dbus_manager_register_object (nm_dbus_manager_get (), priv->path, self);
|
||||||
nm_dbus_manager_register_object (dbus_mgr, priv->path, self);
|
|
||||||
g_object_unref (dbus_mgr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
|
@@ -79,16 +79,15 @@ NMDBusManager *
|
|||||||
nm_dbus_manager_get (void)
|
nm_dbus_manager_get (void)
|
||||||
{
|
{
|
||||||
static NMDBusManager *singleton = NULL;
|
static NMDBusManager *singleton = NULL;
|
||||||
|
static gsize once = 0;
|
||||||
|
|
||||||
if (!singleton) {
|
if (g_once_init_enter (&once)) {
|
||||||
singleton = NM_DBUS_MANAGER (g_object_new (NM_TYPE_DBUS_MANAGER, NULL));
|
singleton = (NMDBusManager *) g_object_new (NM_TYPE_DBUS_MANAGER, NULL);
|
||||||
|
g_assert (singleton);
|
||||||
if (!nm_dbus_manager_init_bus (singleton))
|
if (!nm_dbus_manager_init_bus (singleton))
|
||||||
start_reconnection_timeout (singleton);
|
start_reconnection_timeout (singleton);
|
||||||
} else {
|
g_once_init_leave (&once, 1);
|
||||||
g_object_ref (singleton);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
g_assert (singleton);
|
|
||||||
return singleton;
|
return singleton;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -140,12 +140,9 @@ nm_dhcp4_config_init (NMDHCP4Config *self)
|
|||||||
{
|
{
|
||||||
NMDHCP4ConfigPrivate *priv = NM_DHCP4_CONFIG_GET_PRIVATE (self);
|
NMDHCP4ConfigPrivate *priv = NM_DHCP4_CONFIG_GET_PRIVATE (self);
|
||||||
static guint32 counter = 0;
|
static guint32 counter = 0;
|
||||||
NMDBusManager *dbus_mgr;
|
|
||||||
|
|
||||||
dbus_mgr = nm_dbus_manager_get ();
|
|
||||||
priv->dbus_path = g_strdup_printf (NM_DBUS_PATH "/DHCP4Config/%d", counter++);
|
priv->dbus_path = g_strdup_printf (NM_DBUS_PATH "/DHCP4Config/%d", counter++);
|
||||||
nm_dbus_manager_register_object (dbus_mgr, priv->dbus_path, self);
|
nm_dbus_manager_register_object (nm_dbus_manager_get (), priv->dbus_path, self);
|
||||||
g_object_unref (dbus_mgr);
|
|
||||||
|
|
||||||
priv->options = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, nm_gvalue_destroy);
|
priv->options = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, nm_gvalue_destroy);
|
||||||
}
|
}
|
||||||
|
@@ -140,12 +140,9 @@ nm_dhcp6_config_init (NMDHCP6Config *self)
|
|||||||
{
|
{
|
||||||
NMDHCP6ConfigPrivate *priv = NM_DHCP6_CONFIG_GET_PRIVATE (self);
|
NMDHCP6ConfigPrivate *priv = NM_DHCP6_CONFIG_GET_PRIVATE (self);
|
||||||
static guint32 counter = 0;
|
static guint32 counter = 0;
|
||||||
NMDBusManager *dbus_mgr;
|
|
||||||
|
|
||||||
dbus_mgr = nm_dbus_manager_get ();
|
|
||||||
priv->dbus_path = g_strdup_printf (NM_DBUS_PATH "/DHCP6Config/%d", counter++);
|
priv->dbus_path = g_strdup_printf (NM_DBUS_PATH "/DHCP6Config/%d", counter++);
|
||||||
nm_dbus_manager_register_object (dbus_mgr, priv->dbus_path, self);
|
nm_dbus_manager_register_object (nm_dbus_manager_get (), priv->dbus_path, self);
|
||||||
g_object_unref (dbus_mgr);
|
|
||||||
|
|
||||||
priv->options = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, nm_gvalue_destroy);
|
priv->options = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, nm_gvalue_destroy);
|
||||||
}
|
}
|
||||||
|
@@ -134,14 +134,12 @@ fill_vpn_props (NMIP4Config *ip4_config,
|
|||||||
typedef struct {
|
typedef struct {
|
||||||
DispatcherFunc callback;
|
DispatcherFunc callback;
|
||||||
gpointer user_data;
|
gpointer user_data;
|
||||||
NMDBusManager *dbus_mgr;
|
|
||||||
} DispatchInfo;
|
} DispatchInfo;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
dispatcher_info_free (DispatchInfo *info)
|
dispatcher_info_free (DispatchInfo *info)
|
||||||
{
|
{
|
||||||
requests = g_slist_remove (requests, info);
|
requests = g_slist_remove (requests, info);
|
||||||
g_object_unref (info->dbus_mgr);
|
|
||||||
g_free (info);
|
g_free (info);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -273,7 +271,6 @@ _dispatcher_call (DispatcherAction action,
|
|||||||
DispatcherFunc callback,
|
DispatcherFunc callback,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
NMDBusManager *dbus_mgr;
|
|
||||||
DBusGProxy *proxy;
|
DBusGProxy *proxy;
|
||||||
DBusGConnection *g_connection;
|
DBusGConnection *g_connection;
|
||||||
GHashTable *connection_hash;
|
GHashTable *connection_hash;
|
||||||
@@ -295,15 +292,13 @@ _dispatcher_call (DispatcherAction action,
|
|||||||
if (action == DISPATCHER_ACTION_VPN_UP)
|
if (action == DISPATCHER_ACTION_VPN_UP)
|
||||||
g_return_val_if_fail (vpn_ip4_config != NULL, NULL);
|
g_return_val_if_fail (vpn_ip4_config != NULL, NULL);
|
||||||
|
|
||||||
dbus_mgr = nm_dbus_manager_get ();
|
g_connection = nm_dbus_manager_get_connection (nm_dbus_manager_get ());
|
||||||
g_connection = nm_dbus_manager_get_connection (dbus_mgr);
|
|
||||||
proxy = dbus_g_proxy_new_for_name (g_connection,
|
proxy = dbus_g_proxy_new_for_name (g_connection,
|
||||||
NM_DISPATCHER_DBUS_SERVICE,
|
NM_DISPATCHER_DBUS_SERVICE,
|
||||||
NM_DISPATCHER_DBUS_PATH,
|
NM_DISPATCHER_DBUS_PATH,
|
||||||
NM_DISPATCHER_DBUS_IFACE);
|
NM_DISPATCHER_DBUS_IFACE);
|
||||||
if (!proxy) {
|
if (!proxy) {
|
||||||
nm_log_err (LOGD_CORE, "could not get dispatcher proxy!");
|
nm_log_err (LOGD_CORE, "could not get dispatcher proxy!");
|
||||||
g_object_unref (dbus_mgr);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -342,7 +337,6 @@ _dispatcher_call (DispatcherAction action,
|
|||||||
info = g_malloc0 (sizeof (*info));
|
info = g_malloc0 (sizeof (*info));
|
||||||
info->callback = callback;
|
info->callback = callback;
|
||||||
info->user_data = user_data;
|
info->user_data = user_data;
|
||||||
info->dbus_mgr = dbus_mgr;
|
|
||||||
|
|
||||||
/* Send the action to the dispatcher */
|
/* Send the action to the dispatcher */
|
||||||
call = dbus_g_proxy_begin_call_with_timeout (proxy, "Action",
|
call = dbus_g_proxy_begin_call_with_timeout (proxy, "Action",
|
||||||
|
@@ -145,7 +145,6 @@ void
|
|||||||
nm_ip4_config_export (NMIP4Config *config)
|
nm_ip4_config_export (NMIP4Config *config)
|
||||||
{
|
{
|
||||||
NMIP4ConfigPrivate *priv;
|
NMIP4ConfigPrivate *priv;
|
||||||
NMDBusManager *dbus_mgr;
|
|
||||||
static guint32 counter = 0;
|
static guint32 counter = 0;
|
||||||
|
|
||||||
g_return_if_fail (NM_IS_IP4_CONFIG (config));
|
g_return_if_fail (NM_IS_IP4_CONFIG (config));
|
||||||
@@ -153,10 +152,8 @@ nm_ip4_config_export (NMIP4Config *config)
|
|||||||
priv = NM_IP4_CONFIG_GET_PRIVATE (config);
|
priv = NM_IP4_CONFIG_GET_PRIVATE (config);
|
||||||
g_return_if_fail (priv->path == NULL);
|
g_return_if_fail (priv->path == NULL);
|
||||||
|
|
||||||
dbus_mgr = nm_dbus_manager_get ();
|
|
||||||
priv->path = g_strdup_printf (NM_DBUS_PATH "/IP4Config/%d", counter++);
|
priv->path = g_strdup_printf (NM_DBUS_PATH "/IP4Config/%d", counter++);
|
||||||
nm_dbus_manager_register_object (dbus_mgr, priv->path, config);
|
nm_dbus_manager_register_object (nm_dbus_manager_get (), priv->path, config);
|
||||||
g_object_unref (dbus_mgr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
|
@@ -142,7 +142,6 @@ void
|
|||||||
nm_ip6_config_export (NMIP6Config *config)
|
nm_ip6_config_export (NMIP6Config *config)
|
||||||
{
|
{
|
||||||
NMIP6ConfigPrivate *priv;
|
NMIP6ConfigPrivate *priv;
|
||||||
NMDBusManager *dbus_mgr;
|
|
||||||
static guint32 counter = 0;
|
static guint32 counter = 0;
|
||||||
|
|
||||||
g_return_if_fail (NM_IS_IP6_CONFIG (config));
|
g_return_if_fail (NM_IS_IP6_CONFIG (config));
|
||||||
@@ -150,10 +149,8 @@ nm_ip6_config_export (NMIP6Config *config)
|
|||||||
priv = NM_IP6_CONFIG_GET_PRIVATE (config);
|
priv = NM_IP6_CONFIG_GET_PRIVATE (config);
|
||||||
g_return_if_fail (priv->path == NULL);
|
g_return_if_fail (priv->path == NULL);
|
||||||
|
|
||||||
dbus_mgr = nm_dbus_manager_get ();
|
|
||||||
priv->path = g_strdup_printf (NM_DBUS_PATH "/IP6Config/%d", counter++);
|
priv->path = g_strdup_printf (NM_DBUS_PATH "/IP6Config/%d", counter++);
|
||||||
nm_dbus_manager_register_object (dbus_mgr, priv->path, config);
|
nm_dbus_manager_register_object (nm_dbus_manager_get (), priv->path, config);
|
||||||
g_object_unref (dbus_mgr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
|
@@ -150,15 +150,11 @@ nm_auth_chain_new (DBusGMethodInvocation *context,
|
|||||||
{
|
{
|
||||||
gulong sender_uid = G_MAXULONG;
|
gulong sender_uid = G_MAXULONG;
|
||||||
char *sender = NULL;
|
char *sender = NULL;
|
||||||
NMDBusManager *dbus_mgr;
|
|
||||||
NMAuthChain *chain = NULL;
|
NMAuthChain *chain = NULL;
|
||||||
|
|
||||||
g_return_val_if_fail (context != NULL, NULL);
|
g_return_val_if_fail (context != NULL, NULL);
|
||||||
|
|
||||||
dbus_mgr = nm_dbus_manager_get ();
|
if (nm_dbus_manager_get_caller_info (nm_dbus_manager_get (),
|
||||||
g_assert (dbus_mgr);
|
|
||||||
|
|
||||||
if (nm_dbus_manager_get_caller_info (dbus_mgr,
|
|
||||||
context,
|
context,
|
||||||
&sender,
|
&sender,
|
||||||
&sender_uid)) {
|
&sender_uid)) {
|
||||||
@@ -169,7 +165,6 @@ nm_auth_chain_new (DBusGMethodInvocation *context,
|
|||||||
*out_error_desc = "Unable to determine request UID and sender.";
|
*out_error_desc = "Unable to determine request UID and sender.";
|
||||||
|
|
||||||
g_free (sender);
|
g_free (sender);
|
||||||
g_object_unref (dbus_mgr);
|
|
||||||
return chain;
|
return chain;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -4150,7 +4150,7 @@ dispose (GObject *object)
|
|||||||
dbus_connection_remove_filter (dbus_connection, prop_filter, manager);
|
dbus_connection_remove_filter (dbus_connection, prop_filter, manager);
|
||||||
}
|
}
|
||||||
g_signal_handler_disconnect (priv->dbus_mgr, priv->dbus_connection_changed_id);
|
g_signal_handler_disconnect (priv->dbus_mgr, priv->dbus_connection_changed_id);
|
||||||
g_object_unref (priv->dbus_mgr);
|
priv->dbus_mgr = NULL;
|
||||||
|
|
||||||
if (priv->bluez_mgr)
|
if (priv->bluez_mgr)
|
||||||
g_object_unref (priv->bluez_mgr);
|
g_object_unref (priv->bluez_mgr);
|
||||||
|
@@ -21,7 +21,6 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <dbus/dbus-glib-lowlevel.h>
|
|
||||||
#include <dbus/dbus-glib.h>
|
#include <dbus/dbus-glib.h>
|
||||||
#include <gio/gio.h>
|
#include <gio/gio.h>
|
||||||
#include "nm-logging.h"
|
#include "nm-logging.h"
|
||||||
@@ -73,11 +72,9 @@ upower_resuming_cb (DBusGProxy *proxy, gpointer user_data)
|
|||||||
static void
|
static void
|
||||||
nm_sleep_monitor_init (NMSleepMonitor *self)
|
nm_sleep_monitor_init (NMSleepMonitor *self)
|
||||||
{
|
{
|
||||||
NMDBusManager *dbus_mgr;
|
|
||||||
DBusGConnection *bus;
|
DBusGConnection *bus;
|
||||||
|
|
||||||
dbus_mgr = nm_dbus_manager_get ();
|
bus = nm_dbus_manager_get_connection (nm_dbus_manager_get ());
|
||||||
bus = nm_dbus_manager_get_connection (dbus_mgr);
|
|
||||||
self->upower_proxy = dbus_g_proxy_new_for_name (bus,
|
self->upower_proxy = dbus_g_proxy_new_for_name (bus,
|
||||||
UPOWER_DBUS_SERVICE,
|
UPOWER_DBUS_SERVICE,
|
||||||
"/org/freedesktop/UPower",
|
"/org/freedesktop/UPower",
|
||||||
@@ -94,7 +91,6 @@ nm_sleep_monitor_init (NMSleepMonitor *self)
|
|||||||
self, NULL);
|
self, NULL);
|
||||||
} else
|
} else
|
||||||
nm_log_warn (LOGD_SUSPEND, "could not initialize UPower D-Bus proxy");
|
nm_log_warn (LOGD_SUSPEND, "could not initialize UPower D-Bus proxy");
|
||||||
g_object_unref (dbus_mgr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@@ -317,7 +317,6 @@ void
|
|||||||
nm_ap_export_to_dbus (NMAccessPoint *ap)
|
nm_ap_export_to_dbus (NMAccessPoint *ap)
|
||||||
{
|
{
|
||||||
NMAccessPointPrivate *priv;
|
NMAccessPointPrivate *priv;
|
||||||
NMDBusManager *mgr;
|
|
||||||
static guint32 counter = 0;
|
static guint32 counter = 0;
|
||||||
|
|
||||||
g_return_if_fail (NM_IS_AP (ap));
|
g_return_if_fail (NM_IS_AP (ap));
|
||||||
@@ -329,10 +328,8 @@ nm_ap_export_to_dbus (NMAccessPoint *ap)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
mgr = nm_dbus_manager_get ();
|
|
||||||
priv->dbus_path = g_strdup_printf (NM_DBUS_PATH_ACCESS_POINT "/%d", counter++);
|
priv->dbus_path = g_strdup_printf (NM_DBUS_PATH_ACCESS_POINT "/%d", counter++);
|
||||||
nm_dbus_manager_register_object (mgr, priv->dbus_path, ap);
|
nm_dbus_manager_register_object (nm_dbus_manager_get (), priv->dbus_path, ap);
|
||||||
g_object_unref (mgr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@@ -76,7 +76,6 @@ typedef struct {
|
|||||||
gboolean disposed;
|
gboolean disposed;
|
||||||
|
|
||||||
GPid pid;
|
GPid pid;
|
||||||
NMDBusManager *dbus_manager;
|
|
||||||
char *dbus_path;
|
char *dbus_path;
|
||||||
|
|
||||||
char *parent_iface;
|
char *parent_iface;
|
||||||
@@ -147,20 +146,12 @@ constructor (GType type,
|
|||||||
object = G_OBJECT_CLASS (nm_ppp_manager_parent_class)->constructor (type,
|
object = G_OBJECT_CLASS (nm_ppp_manager_parent_class)->constructor (type,
|
||||||
n_construct_params,
|
n_construct_params,
|
||||||
construct_params);
|
construct_params);
|
||||||
if (!object)
|
if (object) {
|
||||||
return NULL;
|
priv = NM_PPP_MANAGER_GET_PRIVATE (object);
|
||||||
|
priv->dbus_path = g_strdup_printf (NM_DBUS_PATH "/PPP/%d", counter++);
|
||||||
priv = NM_PPP_MANAGER_GET_PRIVATE (object);
|
connection = nm_dbus_manager_get_connection (nm_dbus_manager_get ());
|
||||||
priv->dbus_manager = nm_dbus_manager_get ();
|
dbus_g_connection_register_g_object (connection, priv->dbus_path, object);
|
||||||
if (!priv->dbus_manager) {
|
|
||||||
g_object_unref (object);
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
connection = nm_dbus_manager_get_connection (priv->dbus_manager);
|
|
||||||
priv->dbus_path = g_strdup_printf (NM_DBUS_PATH "/PPP/%d", counter++);
|
|
||||||
dbus_g_connection_register_g_object (connection, priv->dbus_path, object);
|
|
||||||
|
|
||||||
return object;
|
return object;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -178,9 +169,6 @@ dispose (GObject *object)
|
|||||||
g_object_unref (priv->act_req);
|
g_object_unref (priv->act_req);
|
||||||
priv->act_req = NULL;
|
priv->act_req = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_object_unref (priv->dbus_manager);
|
|
||||||
priv->dbus_manager = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
G_OBJECT_CLASS (nm_ppp_manager_parent_class)->dispose (object);
|
G_OBJECT_CLASS (nm_ppp_manager_parent_class)->dispose (object);
|
||||||
|
@@ -1477,7 +1477,7 @@ dispose (GObject *object)
|
|||||||
g_hash_table_destroy (priv->requests);
|
g_hash_table_destroy (priv->requests);
|
||||||
|
|
||||||
g_object_unref (priv->session_monitor);
|
g_object_unref (priv->session_monitor);
|
||||||
g_object_unref (priv->dbus_mgr);
|
priv->dbus_mgr = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
G_OBJECT_CLASS (nm_agent_manager_parent_class)->dispose (object);
|
G_OBJECT_CLASS (nm_agent_manager_parent_class)->dispose (object);
|
||||||
|
@@ -426,7 +426,6 @@ nm_secret_agent_new (DBusGMethodInvocation *context,
|
|||||||
{
|
{
|
||||||
NMSecretAgent *self;
|
NMSecretAgent *self;
|
||||||
NMSecretAgentPrivate *priv;
|
NMSecretAgentPrivate *priv;
|
||||||
NMDBusManager *dbus_mgr;
|
|
||||||
char *hash_str, *username;
|
char *hash_str, *username;
|
||||||
struct passwd *pw;
|
struct passwd *pw;
|
||||||
|
|
||||||
@@ -450,14 +449,12 @@ nm_secret_agent_new (DBusGMethodInvocation *context,
|
|||||||
priv->hash = g_str_hash (hash_str);
|
priv->hash = g_str_hash (hash_str);
|
||||||
g_free (hash_str);
|
g_free (hash_str);
|
||||||
|
|
||||||
dbus_mgr = nm_dbus_manager_get ();
|
priv->proxy = nm_dbus_manager_new_proxy (nm_dbus_manager_get (),
|
||||||
priv->proxy = nm_dbus_manager_new_proxy (dbus_mgr,
|
|
||||||
context,
|
context,
|
||||||
owner,
|
owner,
|
||||||
NM_DBUS_PATH_SECRET_AGENT,
|
NM_DBUS_PATH_SECRET_AGENT,
|
||||||
NM_DBUS_INTERFACE_SECRET_AGENT);
|
NM_DBUS_INTERFACE_SECRET_AGENT);
|
||||||
g_assert (priv->proxy);
|
g_assert (priv->proxy);
|
||||||
g_object_unref (dbus_mgr);
|
|
||||||
|
|
||||||
g_free (username);
|
g_free (username);
|
||||||
return self;
|
return self;
|
||||||
|
@@ -82,7 +82,6 @@ static guint signals[LAST_SIGNAL] = { 0 };
|
|||||||
typedef struct {
|
typedef struct {
|
||||||
gboolean disposed;
|
gboolean disposed;
|
||||||
|
|
||||||
NMDBusManager *dbus_mgr;
|
|
||||||
NMAgentManager *agent_mgr;
|
NMAgentManager *agent_mgr;
|
||||||
NMSessionMonitor *session_monitor;
|
NMSessionMonitor *session_monitor;
|
||||||
guint session_changed_id;
|
guint session_changed_id;
|
||||||
@@ -919,7 +918,6 @@ pk_auth_cb (NMAuthChain *chain,
|
|||||||
static gboolean
|
static gboolean
|
||||||
check_user_in_acl (NMConnection *connection,
|
check_user_in_acl (NMConnection *connection,
|
||||||
DBusGMethodInvocation *context,
|
DBusGMethodInvocation *context,
|
||||||
NMDBusManager *dbus_mgr,
|
|
||||||
NMSessionMonitor *session_monitor,
|
NMSessionMonitor *session_monitor,
|
||||||
gulong *out_sender_uid,
|
gulong *out_sender_uid,
|
||||||
GError **error)
|
GError **error)
|
||||||
@@ -932,7 +930,7 @@ check_user_in_acl (NMConnection *connection,
|
|||||||
g_return_val_if_fail (session_monitor != NULL, FALSE);
|
g_return_val_if_fail (session_monitor != NULL, FALSE);
|
||||||
|
|
||||||
/* Get the caller's UID */
|
/* Get the caller's UID */
|
||||||
if (!nm_dbus_manager_get_caller_info (dbus_mgr, context, NULL, &sender_uid)) {
|
if (!nm_dbus_manager_get_caller_info (nm_dbus_manager_get (), context, NULL, &sender_uid)) {
|
||||||
g_set_error_literal (error,
|
g_set_error_literal (error,
|
||||||
NM_SETTINGS_ERROR,
|
NM_SETTINGS_ERROR,
|
||||||
NM_SETTINGS_ERROR_PERMISSION_DENIED,
|
NM_SETTINGS_ERROR_PERMISSION_DENIED,
|
||||||
@@ -970,7 +968,6 @@ auth_start (NMSettingsConnection *self,
|
|||||||
|
|
||||||
if (!check_user_in_acl (NM_CONNECTION (self),
|
if (!check_user_in_acl (NM_CONNECTION (self),
|
||||||
context,
|
context,
|
||||||
priv->dbus_mgr,
|
|
||||||
priv->session_monitor,
|
priv->session_monitor,
|
||||||
&sender_uid,
|
&sender_uid,
|
||||||
&error)) {
|
&error)) {
|
||||||
@@ -1230,7 +1227,6 @@ impl_settings_connection_update (NMSettingsConnection *self,
|
|||||||
*/
|
*/
|
||||||
if (!check_user_in_acl (tmp,
|
if (!check_user_in_acl (tmp,
|
||||||
context,
|
context,
|
||||||
priv->dbus_mgr,
|
|
||||||
priv->session_monitor,
|
priv->session_monitor,
|
||||||
NULL,
|
NULL,
|
||||||
&error)) {
|
&error)) {
|
||||||
@@ -1721,8 +1717,6 @@ nm_settings_connection_init (NMSettingsConnection *self)
|
|||||||
{
|
{
|
||||||
NMSettingsConnectionPrivate *priv = NM_SETTINGS_CONNECTION_GET_PRIVATE (self);
|
NMSettingsConnectionPrivate *priv = NM_SETTINGS_CONNECTION_GET_PRIVATE (self);
|
||||||
|
|
||||||
priv->dbus_mgr = nm_dbus_manager_get ();
|
|
||||||
|
|
||||||
priv->visible = FALSE;
|
priv->visible = FALSE;
|
||||||
|
|
||||||
priv->session_monitor = nm_session_monitor_get ();
|
priv->session_monitor = nm_session_monitor_get ();
|
||||||
@@ -1773,7 +1767,6 @@ dispose (GObject *object)
|
|||||||
g_signal_handler_disconnect (priv->session_monitor, priv->session_changed_id);
|
g_signal_handler_disconnect (priv->session_monitor, priv->session_changed_id);
|
||||||
g_object_unref (priv->session_monitor);
|
g_object_unref (priv->session_monitor);
|
||||||
g_object_unref (priv->agent_mgr);
|
g_object_unref (priv->agent_mgr);
|
||||||
g_object_unref (priv->dbus_mgr);
|
|
||||||
|
|
||||||
out:
|
out:
|
||||||
G_OBJECT_CLASS (nm_settings_connection_parent_class)->dispose (object);
|
G_OBJECT_CLASS (nm_settings_connection_parent_class)->dispose (object);
|
||||||
|
@@ -1650,7 +1650,7 @@ dispose (GObject *object)
|
|||||||
nm_auth_chain_unref ((NMAuthChain *) iter->data);
|
nm_auth_chain_unref ((NMAuthChain *) iter->data);
|
||||||
g_slist_free (priv->auths);
|
g_slist_free (priv->auths);
|
||||||
|
|
||||||
g_object_unref (priv->dbus_mgr);
|
priv->dbus_mgr = NULL;
|
||||||
|
|
||||||
g_object_unref (priv->session_monitor);
|
g_object_unref (priv->session_monitor);
|
||||||
g_object_unref (priv->agent_mgr);
|
g_object_unref (priv->agent_mgr);
|
||||||
|
@@ -1595,8 +1595,7 @@ dispose (GObject *object)
|
|||||||
|
|
||||||
g_free (priv->dev);
|
g_free (priv->dev);
|
||||||
|
|
||||||
if (priv->dbus_mgr)
|
priv->dbus_mgr = NULL;
|
||||||
g_object_unref (priv->dbus_mgr);
|
|
||||||
|
|
||||||
if (priv->cfg)
|
if (priv->cfg)
|
||||||
g_object_unref (priv->cfg);
|
g_object_unref (priv->cfg);
|
||||||
|
@@ -378,7 +378,7 @@ dispose (GObject *object)
|
|||||||
if (priv->dbus_mgr) {
|
if (priv->dbus_mgr) {
|
||||||
if (priv->name_owner_id)
|
if (priv->name_owner_id)
|
||||||
g_signal_handler_disconnect (priv->dbus_mgr, priv->name_owner_id);
|
g_signal_handler_disconnect (priv->dbus_mgr, priv->name_owner_id);
|
||||||
g_object_unref (G_OBJECT (priv->dbus_mgr));
|
priv->dbus_mgr = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_hash_table_destroy (priv->ifaces);
|
g_hash_table_destroy (priv->ifaces);
|
||||||
|
@@ -1175,19 +1175,18 @@ void
|
|||||||
nm_vpn_connection_activate (NMVPNConnection *connection)
|
nm_vpn_connection_activate (NMVPNConnection *connection)
|
||||||
{
|
{
|
||||||
NMVPNConnectionPrivate *priv;
|
NMVPNConnectionPrivate *priv;
|
||||||
NMDBusManager *dbus_mgr;
|
DBusGConnection *bus;
|
||||||
|
|
||||||
g_return_if_fail (NM_IS_VPN_CONNECTION (connection));
|
g_return_if_fail (NM_IS_VPN_CONNECTION (connection));
|
||||||
g_return_if_fail (nm_vpn_connection_get_vpn_state (connection) == NM_VPN_CONNECTION_STATE_PREPARE);
|
g_return_if_fail (nm_vpn_connection_get_vpn_state (connection) == NM_VPN_CONNECTION_STATE_PREPARE);
|
||||||
|
|
||||||
priv = NM_VPN_CONNECTION_GET_PRIVATE (connection);
|
priv = NM_VPN_CONNECTION_GET_PRIVATE (connection);
|
||||||
|
|
||||||
dbus_mgr = nm_dbus_manager_get ();
|
bus = nm_dbus_manager_get_connection (nm_dbus_manager_get ());
|
||||||
priv->proxy = dbus_g_proxy_new_for_name (nm_dbus_manager_get_connection (dbus_mgr),
|
priv->proxy = dbus_g_proxy_new_for_name (bus,
|
||||||
nm_vpn_connection_get_service (connection),
|
nm_vpn_connection_get_service (connection),
|
||||||
NM_VPN_DBUS_PLUGIN_PATH,
|
NM_VPN_DBUS_PLUGIN_PATH,
|
||||||
NM_VPN_DBUS_PLUGIN_INTERFACE);
|
NM_VPN_DBUS_PLUGIN_INTERFACE);
|
||||||
g_object_unref (dbus_mgr);
|
|
||||||
|
|
||||||
dbus_g_proxy_add_signal (priv->proxy, "Failure", G_TYPE_UINT, G_TYPE_INVALID);
|
dbus_g_proxy_add_signal (priv->proxy, "Failure", G_TYPE_UINT, G_TYPE_INVALID);
|
||||||
dbus_g_proxy_connect_signal (priv->proxy, "Failure",
|
dbus_g_proxy_connect_signal (priv->proxy, "Failure",
|
||||||
|
@@ -450,7 +450,7 @@ dispose (GObject *object)
|
|||||||
clear_quit_timeout (self);
|
clear_quit_timeout (self);
|
||||||
service_quit (self);
|
service_quit (self);
|
||||||
|
|
||||||
g_object_unref (priv->dbus_mgr);
|
priv->dbus_mgr = NULL;
|
||||||
|
|
||||||
g_free (priv->name);
|
g_free (priv->name);
|
||||||
g_free (priv->dbus_service);
|
g_free (priv->dbus_service);
|
||||||
|
Reference in New Issue
Block a user