From 85c6ac2ff860194111fc1e64b4e2d8130575a4ff Mon Sep 17 00:00:00 2001 From: Evangelos Ribeiro Tzaras Date: Fri, 14 Jan 2022 09:09:13 +0100 Subject: [PATCH] tests: dummy origin: Use correct origin And unref it after we're done. Otherwise we're leaking memory because the dummy provider only keeps actively unrefs the origin it added itself. --- tests/setup-origin.c | 5 +++-- tests/setup-origin.h | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/setup-origin.c b/tests/setup-origin.c index e7d0c11..b4f182d 100644 --- a/tests/setup-origin.c +++ b/tests/setup-origin.c @@ -15,12 +15,13 @@ test_dummy_origin_set_up (OriginFixture *fixture, test_dummy_provider_set_up (&fixture->parent, user_data); + /* provider adds an origin with name "Dummy origin" by itself... */ calls_dummy_provider_add_origin (fixture->parent.dummy_provider, TEST_ORIGIN_NAME); origins = calls_provider_get_origins (CALLS_PROVIDER (fixture->parent.dummy_provider)); - fixture->dummy_origin = g_list_model_get_item (origins, 0); + fixture->dummy_origin = g_list_model_get_item (origins, 1); } @@ -28,6 +29,6 @@ void test_dummy_origin_tear_down (OriginFixture *fixture, gconstpointer user_data) { - fixture->dummy_origin = NULL; + g_clear_object (&fixture->dummy_origin); test_dummy_provider_tear_down (&fixture->parent, user_data); } diff --git a/tests/setup-origin.h b/tests/setup-origin.h index acd5885..000be92 100644 --- a/tests/setup-origin.h +++ b/tests/setup-origin.h @@ -7,7 +7,7 @@ #include "setup-provider.h" #include "calls-dummy-origin.h" -#define TEST_ORIGIN_NAME "Dummy origin" +#define TEST_ORIGIN_NAME "Test Dummy origin" #define TEST_CALL_NUMBER "0123456789"