static void evd_dbus_agent_conn_data_unref (ConnData *conn_data) { conn_data->ref_count--; if (conn_data->ref_count <= 0) { if (conn_cache != NULL) g_hash_table_remove (conn_cache, conn_data->addr); if (conn_data->conn != NULL) { g_dbus_connection_close (conn_data->conn, NULL, NULL, NULL); g_object_unref (conn_data->conn); } g_free (conn_data->addr); g_slice_free (ConnData, conn_data); } }
static void unregister_objects_and_close_connection (MainData *data) { guint i; /* Unregister all our DfsmObjects. */ for (i = 0; i < data->simulated_objects->len; i++) { DfsmObject *simulated_object = g_ptr_array_index (data->simulated_objects, i); dfsm_object_unregister_on_bus (simulated_object); g_signal_handlers_disconnect_by_func (simulated_object, simulated_object_dbus_activity_count_notify_cb, data); } /* Disconnect from the bus. */ if (data->connection != NULL) { g_dbus_connection_close (data->connection, NULL, (GAsyncReadyCallback) connection_close_cb, data); } else { /* Connection's already closed. */ post_connection_closed (data); } }