From b37db33c628675971f118fb3e241dc32a9f0a5d0 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Thu, 21 Apr 2016 11:22:56 -0500 Subject: tell glib not to exit when the gdbusconnection is closed --- tests/unit/greeter-test.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/unit/greeter-test.cpp b/tests/unit/greeter-test.cpp index b33c300..72df3bc 100644 --- a/tests/unit/greeter-test.cpp +++ b/tests/unit/greeter-test.cpp @@ -41,6 +41,7 @@ protected: std::shared_ptr m_dbus_runner; std::shared_ptr m_dbus_mock; + GDBusConnection* m_bus {}; void SetUp() override { @@ -49,6 +50,18 @@ protected: // use a fresh bus for each test run m_dbus_runner.reset(new QtDBusTest::DBusTestRunner()); m_dbus_mock.reset(new QtDBusMock::DBusMock(*m_dbus_runner.get())); + + GError* error {}; + m_bus = g_bus_get_sync (G_BUS_TYPE_SESSION, nullptr, &error); + g_assert_no_error(error); + g_dbus_connection_set_exit_on_close(m_bus, FALSE); + } + + void TearDown() override + { + g_clear_object(&m_bus); + + super::TearDown(); } void start_greeter_service(bool is_active) -- cgit v1.2.3