From 2e6261b9981d51feff0f2f04433614f86305a497 Mon Sep 17 00:00:00 2001 From: Olaf Wintermann Date: Fri, 9 Jan 2026 14:34:13 +0100 Subject: [PATCH] extent test_init_note_store: test opening an existing database --- application/store.c | 7 +++++-- application/tests/test-store.c | 7 +++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/application/store.c b/application/store.c index f061cb2..74cd87a 100644 --- a/application/store.c +++ b/application/store.c @@ -184,7 +184,9 @@ int init_note_store() { } } - queue = ui_threadpool_create(1); + if(!queue) { + queue = ui_threadpool_create(1); + } return 0; } @@ -221,7 +223,8 @@ CxList* note_store_get_user_settings(const CxAllocator *a, const char *host, con } void close_note_store() { - connection->free(connection); + dbuConnectionFree(connection); + connection = NULL; } diff --git a/application/tests/test-store.c b/application/tests/test-store.c index 453cb6a..0beb76d 100644 --- a/application/tests/test-store.c +++ b/application/tests/test-store.c @@ -35,5 +35,12 @@ CX_TEST(test_init_note_store) { int ret = init_note_store(); CX_TEST_ASSERT(ret == 0); + + close_note_store(); + + // test init_note_store again, this time it should not initialize + // the database + int ret2 = init_note_store(); + CX_TEST_ASSERT(ret2 == 0); } } -- 2.47.3