mirror of
https://gitlab.freedesktop.org/dbus/dbus.git
synced 2026-05-02 21:18:24 +02:00
containers test: Factor out fixture_disconnect_observer
Signed-off-by: Simon McVittie <smcv@collabora.com> Reviewed-by: Philip Withnall <withnall@endlessm.com> Bug: https://bugs.freedesktop.org/show_bug.cgi?id=105656
This commit is contained in:
parent
d26639ecc2
commit
3837cd4d8a
1 changed files with 22 additions and 15 deletions
|
|
@ -173,6 +173,27 @@ fixture_disconnect_unconfined (Fixture *f)
|
|||
g_clear_object (&f->unconfined_conn);
|
||||
}
|
||||
|
||||
static void
|
||||
fixture_disconnect_observer (Fixture *f)
|
||||
{
|
||||
if (f->observer_conn != NULL)
|
||||
{
|
||||
GError *error = NULL;
|
||||
|
||||
g_dbus_connection_signal_unsubscribe (f->observer_conn,
|
||||
f->removed_sub);
|
||||
|
||||
g_dbus_connection_close_sync (f->observer_conn, NULL, &error);
|
||||
|
||||
if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CLOSED))
|
||||
g_clear_error (&error);
|
||||
else
|
||||
g_assert_no_error (error);
|
||||
}
|
||||
|
||||
g_clear_object (&f->observer_conn);
|
||||
}
|
||||
|
||||
static void
|
||||
setup (Fixture *f,
|
||||
gconstpointer context)
|
||||
|
|
@ -1590,22 +1611,8 @@ teardown (Fixture *f,
|
|||
{
|
||||
g_clear_object (&f->proxy);
|
||||
|
||||
if (f->observer_conn != NULL)
|
||||
{
|
||||
GError *error = NULL;
|
||||
|
||||
g_dbus_connection_signal_unsubscribe (f->observer_conn,
|
||||
f->removed_sub);
|
||||
g_dbus_connection_close_sync (f->observer_conn, NULL, &error);
|
||||
|
||||
if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CLOSED))
|
||||
g_clear_error (&error);
|
||||
else
|
||||
g_assert_no_error (error);
|
||||
}
|
||||
|
||||
fixture_disconnect_observer (f);
|
||||
g_clear_pointer (&f->containers_removed, g_hash_table_unref);
|
||||
g_clear_object (&f->observer_conn);
|
||||
|
||||
if (f->libdbus_observer != NULL)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue