コード例 #1
0
DBusConnection *setup_dbus_bus(DBusBusType type, const char *name,
							DBusError *error)
{
	DBusConnection *conn;
	LOG("setup_dbus_bus");
	conn = dbus_bus_get(type, error);
	if (error != NULL) {
		if (dbus_error_is_set(error) == TRUE)
			return NULL;
	}
	if (conn == NULL)
		return NULL;
	if (setup_bus(conn, name, error) == FALSE) {
		dbus_connection_unref(conn);
		return NULL;
	}
	return conn;
}
コード例 #2
0
ファイル: reporter.c プロジェクト: BalintBanyasz/bluez-rda
void reporter_exit(struct btd_adapter *adapter)
{
	struct reporter_adapter *radapter = find_reporter_adapter(adapter);
	if (!radapter)
		return;

	btd_unregister_device_driver(&reporter_device_driver);

	g_slist_foreach(radapter->devices, unregister_reporter_device,
								radapter);

	link_loss_unregister(adapter);
	imm_alert_unregister(adapter);
	dbus_connection_unref(radapter->conn);

	reporter_adapters = g_slist_remove(reporter_adapters, radapter);
	g_free(radapter);
}
/**
 * wpa_supplicant_dbus_ctrl_iface_deinit - Deinitialize dbus ctrl interface
 * @iface: Pointer to dbus private data from
 * wpa_supplicant_dbus_ctrl_iface_init()
 *
 * Deinitialize the dbus control interface that was initialized with
 * wpa_supplicant_dbus_ctrl_iface_init().
 */
void wpa_supplicant_dbus_ctrl_iface_deinit(struct ctrl_iface_dbus_priv *iface)
{
	if (iface == NULL)
		return;

	if (iface->con) {
		eloop_cancel_timeout(dispatch_initial_dbus_messages,
				     iface->con, NULL);
		dbus_connection_set_watch_functions(iface->con, NULL, NULL,
						    NULL, NULL, NULL);
		dbus_connection_set_timeout_functions(iface->con, NULL, NULL,
						      NULL, NULL, NULL);
		dbus_connection_unref(iface->con);
	}

	memset(iface, 0, sizeof(struct ctrl_iface_dbus_priv));
	free(iface);
}
コード例 #4
0
ファイル: UDisksProvider.cpp プロジェクト: DJMatty/xbmc
CUDisksProvider::~CUDisksProvider()
{
  DeviceMap::iterator itr;

  for (itr = m_AvailableDevices.begin(); itr != m_AvailableDevices.end(); ++itr)
    delete m_AvailableDevices[itr->first];

  m_AvailableDevices.clear();

  if (m_connection)
  {
    dbus_connection_close(m_connection);
    dbus_connection_unref(m_connection);
    m_connection = NULL;
  }

  dbus_error_free (&m_error);
}
コード例 #5
0
void connman_service_finalize(void)
{
	if (service_if == NULL)
		return;

	__connman_manager_register_service_signal(NULL);

	dbus_connection_unref(service_if->dbus_cnx);

	connman_service_deselect();

	g_slist_free(service_if->ordered_services);
	g_hash_table_destroy(service_if->services);

	g_free(service_if);

	service_if = NULL;
}
コード例 #6
0
ファイル: alarmd.c プロジェクト: tidatida/alarmd
static int clear_user_data(void)
{
  const char *dest  = ALARMD_SERVICE;
  const char *path  = ALARMD_PATH;
  const char *iface = ALARMD_INTERFACE;
  const char *name  = "clear_user_data";

  dbus_int32_t    nak = -1;
  DBusConnection *con = 0;
  DBusMessage    *msg = 0;
  DBusMessage    *rsp = 0;
  DBusError       err = DBUS_ERROR_INIT;

  if( (con = dbus_bus_get(DBUS_BUS_SYSTEM, &err)) == 0 )
  {
    goto cleanup;
  }

  if( (msg = dbus_message_new_method_call(dest, path, iface, name)) == 0 )
  {
    goto cleanup;
  }

  dbus_message_set_auto_start(msg, FALSE);

  if( !(rsp = dbus_connection_send_with_reply_and_block(con, msg, -1, &err)) )
  {
    goto cleanup;
  }

  dbus_message_get_args(rsp, &err,
                        DBUS_TYPE_INT32, &nak,
                        DBUS_TYPE_INVALID);

  cleanup:

  if( rsp != 0 ) dbus_message_unref(rsp);
  if( msg != 0 ) dbus_message_unref(msg);
  if( con != 0 ) dbus_connection_unref(con);

  dbus_error_free(&err);

  return (int)nak;
}
コード例 #7
0
ファイル: OMXControl.cpp プロジェクト: entrusc/omxplayer
int OMXControl::dbus_connect(std::string& dbus_name)
{
  DBusError error;

  dbus_error_init(&error);
  if (!(bus = dbus_bus_get_private(DBUS_BUS_SESSION, &error)))
  {
    CLog::Log(LOGWARNING, "dbus_bus_get_private(): %s", error.message);
        goto fail;
  }

  dbus_connection_set_exit_on_disconnect(bus, FALSE);

  if (dbus_bus_request_name(
        bus,
        dbus_name.c_str(),
        DBUS_NAME_FLAG_DO_NOT_QUEUE,
        &error) != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER)
  {
        if (dbus_error_is_set(&error))
        {
            CLog::Log(LOGWARNING, "dbus_bus_request_name(): %s", error.message);
            goto fail;
        }

        CLog::Log(LOGWARNING, "Failed to acquire D-Bus name '%s'", dbus_name.c_str());
        goto fail;
    }

    return 0;

fail:
    if (dbus_error_is_set(&error))
        dbus_error_free(&error);

    if (bus)
    {
        dbus_connection_close(bus);
        dbus_connection_unref(bus);
        bus = NULL;
    }

    return -1;
}
コード例 #8
0
ファイル: service.c プロジェクト: 520lly/bluez
static void auth_cb(DBusError *derr, void *user_data)
{
	struct service_adapter *serv_adapter = user_data;
	DBusMessage *reply;
	struct pending_auth *auth;
	bdaddr_t src;

	auth = next_pending(serv_adapter);
	if (auth == NULL) {
		info("Authorization cancelled: Client exited");
		return;
	}

	if (derr) {
		error("Access denied: %s", derr->message);

		reply = btd_error_not_authorized(auth->msg);
		dbus_message_unref(auth->msg);
		g_dbus_send_message(auth->conn, reply);
		goto done;
	}

	g_dbus_send_reply(auth->conn, auth->msg,
			DBUS_TYPE_INVALID);

done:
	dbus_connection_unref(auth->conn);

	serv_adapter->pending_list = g_slist_remove(serv_adapter->pending_list,
									auth);
	g_free(auth);

	auth = next_pending(serv_adapter);
	if (auth == NULL)
		return;

	if (serv_adapter->adapter)
		adapter_get_address(serv_adapter->adapter, &src);
	else
		bacpy(&src, BDADDR_ANY);

	btd_request_authorization(&src, &auth->dst,
					auth->uuid, auth_cb, serv_adapter);
}
コード例 #9
0
ファイル: client.c プロジェクト: EBone/Faust
static void client_set_state(AvahiClient *client, AvahiClientState state) {
    assert(client);

    if (client->state == state)
        return;

    client->state = state;

    switch (client->state) {
        case AVAHI_CLIENT_FAILURE:
            if (client->bus) {
#ifdef HAVE_DBUS_CONNECTION_CLOSE
                dbus_connection_close(client->bus);
#else
                dbus_connection_disconnect(client->bus);
#endif
                dbus_connection_unref(client->bus);
                client->bus = NULL;
            }

            /* Fall through */

        case AVAHI_CLIENT_S_COLLISION:
        case AVAHI_CLIENT_S_REGISTERING:

            /* Clear cached strings */
            avahi_free(client->host_name);
            avahi_free(client->host_name_fqdn);
            avahi_free(client->domain_name);

            client->host_name =  NULL;
            client->host_name_fqdn = NULL;
            client->domain_name = NULL;
            break;

        case AVAHI_CLIENT_S_RUNNING:
        case AVAHI_CLIENT_CONNECTING:
            break;

    }

    if (client->callback)
        client->callback (client, state, client->userdata);
}
コード例 #10
0
ファイル: bluetooth.c プロジェクト: igaw/connman
static void bluetooth_exit(void)
{
	/*
	 * We unset the disabling of the Bluetooth device when shutting down
	 * so that non-PAN BT connections are not affected.
	 */
	device_driver.disable = NULL;

	g_dbus_client_unref(client);

	connman_network_driver_unregister(&network_driver);
	g_hash_table_destroy(networks);

	connman_device_driver_unregister(&device_driver);
	g_hash_table_destroy(devices);

	connman_technology_driver_unregister(&tech_driver);
	dbus_connection_unref(connection);
}
コード例 #11
0
ファイル: dbus-mainloop.c プロジェクト: scottt/dbus-vmci
void
_dbus_loop_unref (DBusLoop *loop)
{
    _dbus_assert (loop != NULL);
    _dbus_assert (loop->refcount > 0);

    loop->refcount -= 1;
    if (loop->refcount == 0)
    {
        while (loop->need_dispatch)
        {
            DBusConnection *connection = _dbus_list_pop_first (&loop->need_dispatch);

            dbus_connection_unref (connection);
        }

        dbus_free (loop);
    }
}
コード例 #12
0
ファイル: dbus_common.c プロジェクト: 2asoft/freebsd
static void wpas_dbus_deinit_common(struct wpas_dbus_priv *priv)
{
	if (priv->con) {
		eloop_cancel_timeout(dispatch_initial_dbus_messages,
				     priv->con, NULL);
		eloop_cancel_timeout(process_timeout, priv, ELOOP_ALL_CTX);

		dbus_connection_set_watch_functions(priv->con, NULL, NULL,
						    NULL, NULL, NULL);
		dbus_connection_set_timeout_functions(priv->con, NULL, NULL,
						      NULL, NULL, NULL);
		dbus_connection_remove_filter(priv->con, disconnect_filter,
					      priv);

		dbus_connection_unref(priv->con);
	}

	os_free(priv);
}
コード例 #13
0
void __connman_tethering_cleanup(void)
{
	DBG("enabled %d", tethering_enabled);

	__sync_synchronize();
	if (tethering_enabled > 0) {
		if (tethering_dhcp_server)
			dhcp_server_stop(tethering_dhcp_server);
		__connman_bridge_disable(BRIDGE_NAME);
		__connman_bridge_remove(BRIDGE_NAME);
		__connman_nat_disable(BRIDGE_NAME);
	}

	if (connection == NULL)
		return;

	g_hash_table_destroy(pn_hash);
	dbus_connection_unref(connection);
}
コード例 #14
0
ファイル: ac_manage_dbus.c プロジェクト: inibir/daemongroup
static DBusHandlerResult
ac_manage_dbus_filter_function (DBusConnection * connection, DBusMessage * message, void *user_data) {

	if(dbus_message_is_signal(message, DBUS_INTERFACE_LOCAL, "Disconnected") 
		&& strcmp(dbus_message_get_path(message), DBUS_PATH_LOCAL) == 0) {
		dbus_connection_unref(ac_manage_dbus_connection);
		ac_manage_dbus_connection = NULL;
	}
#if 0	
	else if((dbus_message_is_signal (message, SNMP_MANAGE_DBUS_INTERFACE, NPD_DBUS_ROUTE_METHOD_NOTIFY_SNMP_MIB_BY_VRRP))) {
		snmp_mib_dbus_had_master_advertise(message);
	}
#endif	
	else {
		return TRUE;
	}
	
	return DBUS_HANDLER_RESULT_HANDLED;
}
コード例 #15
0
ファイル: cpu-keepalive.c プロジェクト: spiiroin/mce
/** Remove signal and method call message handlers
 */
static void cka_dbus_quit(void)
{
  if( !cka_dbus_systembus )
  {
    goto EXIT;
  }

  /* Remove signal handling filter */
  dbus_connection_remove_filter(cka_dbus_systembus,
                                cka_dbus_filter_message_cb, 0);

  /* Remove dbus method call handlers that we have registered */
  mce_dbus_handler_unregister_array(cka_dbus_handlers);

  dbus_connection_unref(cka_dbus_systembus), cka_dbus_systembus = 0;

EXIT:
  return;
}
コード例 #16
0
ファイル: services.c プロジェクト: Drakey83/steamlink-sdk
static void
free_ownership_restore_data (void *data)
{
  OwnershipRestoreData *d = data;

  if (d->service_link)
    _dbus_list_free_link (d->service_link);
  if (d->owner_link)
    _dbus_list_free_link (d->owner_link);
  if (d->hash_entry)
    _dbus_hash_table_free_preallocated_entry (d->service->registry->service_hash,
                                              d->hash_entry);

  dbus_connection_unref (d->owner->conn);
  bus_owner_unref (d->owner);
  bus_service_unref (d->service);
  
  dbus_free (d);
}
コード例 #17
0
ファイル: hostnamectl.c プロジェクト: kwirk/systemd
int main(int argc, char *argv[]) {
        int r, retval = EXIT_FAILURE;
        DBusConnection *bus = NULL;
        DBusError error;

        dbus_error_init(&error);

        setlocale(LC_ALL, "");
        log_parse_environment();
        log_open();

        r = parse_argv(argc, argv);
        if (r < 0)
                goto finish;
        else if (r == 0) {
                retval = EXIT_SUCCESS;
                goto finish;
        }

        if (arg_transport == TRANSPORT_NORMAL)
                bus = dbus_bus_get_private(DBUS_BUS_SYSTEM, &error);
        else if (arg_transport == TRANSPORT_POLKIT)
                bus_connect_system_polkit(&bus, &error);
        else if (arg_transport == TRANSPORT_SSH)
                bus_connect_system_ssh(NULL, arg_host, &bus, &error);
        else
                assert_not_reached("Uh, invalid transport...");

        r = hostnamectl_main(bus, argc, argv, &error);
        retval = r < 0 ? EXIT_FAILURE : r;

finish:
        if (bus) {
                dbus_connection_flush(bus);
                dbus_connection_close(bus);
                dbus_connection_unref(bus);
        }

        dbus_error_free(&error);
        dbus_shutdown();

        return retval;
}
コード例 #18
0
ファイル: efl.c プロジェクト: connectivity/connline
DBusConnection *connline_plugin_setup_event_loop(void)
{
	DBusConnection *dbus_cnx;

	dbus_cnx = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
	if (dbus_cnx == NULL)
		return NULL;

	if (setup_dbus_in_efl_mainloop(dbus_cnx) == FALSE) {
		dbus_connection_unref(dbus_cnx);
		return NULL;
	}

	if (triggers_table == NULL)
		triggers_table = eina_hash_pointer_new(
						remove_context_triggers);

	return dbus_cnx;
}
コード例 #19
0
ファイル: main.c プロジェクト: crow89/Alcatel_OT_985_kernel
static int audio_init(void)
{
	GKeyFile *config;
	gboolean enable_sco;

	connection = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
	if (connection == NULL)
		return -EIO;

	config = load_config_file(CONFIGDIR "/audio.conf");

	if (unix_init() < 0) {
		error("Unable to setup unix socket");
		goto failed;
	}

	if (audio_manager_init(connection, config, &enable_sco) < 0)
		goto failed;

	if (!enable_sco)
		return 0;

	sco_server = bt_io_listen(BT_IO_SCO, sco_server_cb, NULL, NULL,
					NULL, NULL,
					BT_IO_OPT_INVALID);
	if (!sco_server) {
		error("Unable to start SCO server socket");
		goto failed;
	}

	return 0;

failed:
	audio_manager_exit();
	unix_exit();

	if (connection) {
		dbus_connection_unref(connection);
		connection = NULL;
	}

	return -EIO;
}
コード例 #20
0
ファイル: map.c プロジェクト: alvarofagner/bluez
int map_init(void)
{
	int err;

	DBG("");

	conn = dbus_bus_get(DBUS_BUS_SESSION, NULL);
	if (!conn)
		return -EIO;

	err = obc_driver_register(&map);
	if (err < 0) {
		dbus_connection_unref(conn);
		conn = NULL;
		return err;
	}

	return 0;
}
コード例 #21
0
ファイル: simplehal.c プロジェクト: bbidulock/dockapps
int hal_ready(void)
{
	if (hal_ctx && dbus_connection_get_is_connected(dbus_ctx)) {
		return 1;
	} else {
		/* The messy business of reconnecting.
		 * dbus's design is crap when it comes to reconnecting.
		 * If dbus is down, can't actually close the connection to hal,
		 * since libhal wants to use dbus to do it. */
		if (dbus_ctx) {
			dbus_connection_close(dbus_ctx);
			dbus_connection_unref(dbus_ctx);
		}
		dbus_ctx = NULL;
		hal_ctx = NULL;

		return connect_hal();
	}
}
コード例 #22
0
ファイル: tizen.c プロジェクト: aklein53/neard
static int tapi_init(void)
{
	int err;

	DBG("");

	connection = near_dbus_get_connection();
	if (connection == NULL)
		return -EIO;

	watch = g_dbus_add_service_watch(connection, TELEPHONY_SERVICE,
					tapi_connect, tapi_disconnect,
					NULL, NULL);

	sim_watch = g_dbus_add_signal_watch(connection, TELEPHONY_SERVICE,
					NULL, SIM_INTERFACE, SIM_STATUS,
					sim_changed, NULL, NULL);

	if (watch == 0 || sim_watch == 0) {
		err = -EIO;
		goto remove;
	}

	err = seel_io_driver_register(&tizen_io_driver);
	if (err < 0)
		goto remove;

	err = seel_cert_driver_register(&tizen_cert_driver);
	if (err < 0) {
		seel_io_driver_unregister(&tizen_io_driver);
		goto remove;
	}

	return 0;

remove:
	g_dbus_remove_watch(connection, watch);
	g_dbus_remove_watch(connection, sim_watch);

	dbus_connection_unref(connection);

	return err;
}
コード例 #23
0
ファイル: bluetooth_legacy.c プロジェクト: manjurajv/connman
static void bluetooth_exit(void)
{
	g_dbus_remove_watch(connection, watch);
	g_dbus_remove_watch(connection, added_watch);
	g_dbus_remove_watch(connection, removed_watch);
	g_dbus_remove_watch(connection, adapter_watch);
	g_dbus_remove_watch(connection, device_removed_watch);
	g_dbus_remove_watch(connection, device_watch);
	g_dbus_remove_watch(connection, network_watch);

	bluetooth_disconnect(connection, NULL);

	connman_technology_driver_unregister(&tech_driver);

	connman_device_driver_unregister(&bluetooth_driver);
	connman_network_driver_unregister(&pan_driver);

	dbus_connection_unref(connection);
}
コード例 #24
0
void avrcp_exit(void)
{
	if (!avctp_server)
		return;

	g_io_channel_close(avctp_server);
	g_io_channel_unref(avctp_server);
	avctp_server = NULL;

#ifndef ANDROID
	remove_record_from_server(ct_record_id);
	ct_record_id = 0;
#endif
	remove_record_from_server(tg_record_id);
	tg_record_id = 0;

	dbus_connection_unref(connection);
	connection = NULL;
}
コード例 #25
0
ファイル: usbtracker.c プロジェクト: pgerdt/dsme
DSME_HANDLER(DSM_MSGTYPE_DBUS_CONNECT, client, msg)
{
    dsme_log(LOG_DEBUG, "usbtracker: DBUS_CONNECT");
    dsme_dbus_bind_signals(&bound, signals);

    /* we are connected on dbus, now we can query
     * charger/usb connection details */

    DBusError        err  = DBUS_ERROR_INIT;
    DBusPendingCall *pc   = 0;
    DBusConnection  *conn = 0;
    DBusMessage     *req  = NULL;

    if( !(conn = dbus_bus_get(DBUS_BUS_SYSTEM, &err)) )
    {
        dsme_log(LOG_ERR, "DBUS_BUS_SYSTEM: %s: %s",
                 err.name, err.message);
        goto cleanup;
    }

    req = dbus_message_new_method_call("com.meego.usb_moded",
                                       "/com/meego/usb_moded",
                                       "com.meego.usb_moded",
                                       "mode_request");
    if( !req )
        goto cleanup;

    if( !dbus_connection_send_with_reply(conn, req, &pc, -1) )
        goto cleanup;

    if( !dbus_pending_call_set_notify(pc, mode_request_cb, 0, 0) )
        goto cleanup;

    dsme_log(LOG_DEBUG, "usbtracker: mode_request sent");

cleanup:

    if( pc ) dbus_pending_call_unref(pc);
    if( req ) dbus_message_unref(req);
    if( conn ) dbus_connection_unref(conn);
    dbus_error_free(&err);
}
コード例 #26
0
ファイル: dbus.c プロジェクト: RicoP/vlcfork
static void Close   ( vlc_object_t *p_this )
{
    intf_thread_t   *p_intf     = (intf_thread_t*) p_this;
    intf_sys_t      *p_sys      = p_intf->p_sys;
    playlist_t      *p_playlist = p_sys->p_playlist;

    var_DelCallback( p_playlist, "item-current", AllCallback, p_intf );
    var_DelCallback( p_playlist, "intf-change", AllCallback, p_intf );
    var_DelCallback( p_playlist, "volume", AllCallback, p_intf );
    var_DelCallback( p_playlist, "mute", AllCallback, p_intf );
    var_DelCallback( p_playlist, "playlist-item-append", AllCallback, p_intf );
    var_DelCallback( p_playlist, "playlist-item-deleted", AllCallback, p_intf );
    var_DelCallback( p_playlist, "random", AllCallback, p_intf );
    var_DelCallback( p_playlist, "repeat", AllCallback, p_intf );
    var_DelCallback( p_playlist, "loop", AllCallback, p_intf );
    var_DelCallback( p_playlist, "fullscreen", AllCallback, p_intf );

    if( p_sys->p_input )
    {
        var_DelCallback( p_sys->p_input, "intf-event", AllCallback, p_intf );
        var_DelCallback( p_sys->p_input, "can-pause", AllCallback, p_intf );
        var_DelCallback( p_sys->p_input, "can-seek", AllCallback, p_intf );
        vlc_object_release( p_sys->p_input );
    }

    /* The dbus connection is private, so we are responsible
     * for closing it */
    dbus_connection_close( p_sys->p_conn );
    dbus_connection_unref( p_sys->p_conn );

    // Free the events array
    for( int i = 0; i < vlc_array_count( p_sys->p_events ); i++ )
    {
        callback_info_t* info = vlc_array_item_at_index( p_sys->p_events, i );
        free( info );
    }
    vlc_mutex_destroy( &p_sys->lock );
    vlc_array_destroy( p_sys->p_events );
    vlc_array_destroy( p_sys->p_timeouts );
    vlc_array_destroy( p_sys->p_watches );
    free( p_sys );
}
コード例 #27
0
static void
_dbus_pending_call_last_unref (DBusPendingCall *pending)
{
  DBusConnection *connection;
  
  /* If we get here, we should be already detached
   * from the connection, or never attached.
   */
  _dbus_assert (!pending->timeout_added);  

  connection = pending->connection;

  /* this assumes we aren't holding connection lock... */
  _dbus_data_slot_list_free (&pending->slot_list);

  if (pending->timeout != NULL)
    _dbus_timeout_unref (pending->timeout);
      
  if (pending->timeout_link)
    {
      dbus_message_unref ((DBusMessage *)pending->timeout_link->data);
      _dbus_list_free_link (pending->timeout_link);
      pending->timeout_link = NULL;
    }

  if (pending->reply)
    {
      dbus_message_unref (pending->reply);
      pending->reply = NULL;
    }
      
  dbus_free (pending);

  dbus_pending_call_free_data_slot (&notify_user_data_slot);

  /* connection lock should not be held. */
  /* Free the connection last to avoid a weird state while
   * calling out to application code where the pending exists
   * but not the connection.
   */
  dbus_connection_unref (connection);
}
コード例 #28
0
ファイル: pacrunner.c プロジェクト: aldebaran/connman-stable
static int pacrunner_init(void)
{
	connection = connman_dbus_get_connection();
	if (connection == NULL)
		return -EIO;

	pacrunner_watch = g_dbus_add_service_watch(connection,
					PACRUNNER_SERVICE, pacrunner_connect,
					pacrunner_disconnect, NULL, NULL);
	if (pacrunner_watch == 0) {
		dbus_connection_unref(connection);
		return -EIO;
	}

	connman_notifier_register(&pacrunner_notifier);

	connman_proxy_driver_register(&pacrunner_proxy);

	return 0;
}
コード例 #29
0
static DBusMessage *agent_release_method(DBusConnection *dbus_cnx,
						DBusMessage *msg, void *data)
{
	if (agent_if == NULL)
		goto reply;

	g_dbus_unregister_interface(agent_if->dbus_cnx,
				CONNMAN_AGENT_PATH, CONNMAN_AGENT_INTERFACE);

	if (agent_if->pending_reply != NULL)
		dbus_message_unref(agent_if->pending_reply);

	dbus_connection_unref(agent_if->dbus_cnx);

	g_free(agent_if);
	agent_if = NULL;

reply:
	return g_dbus_create_reply(msg, DBUS_TYPE_INVALID);
}
コード例 #30
0
ファイル: hippo-dbus-system.c プロジェクト: nihed/magnetism
static void
hippo_system_dbus_finalize(GObject *object)
{
    HippoSystemDBus *dbus = HIPPO_SYSTEM_DBUS(object);

    g_debug("Finalizing dbus object");

    if (!dbus->emitted_disconnected)
        g_warning("Messed-up reference counting on HippoSystemDBus object - connected state should own a ref");
    

#ifdef HAVE_DBUS_1_0
    /* pre-1.0 dbus is all f'd up and may crash if we do this when the
     * connection is still connected.
     */
    dbus_connection_unref(dbus->connection);
#endif
    
    G_OBJECT_CLASS(hippo_system_dbus_parent_class)->finalize(object);
}