From: Olaf Wintermann Date: Fri, 9 Jan 2026 13:34:13 +0000 (+0100) Subject: extent test_init_note_store: test opening an existing database X-Git-Url: https://uap-core.de/gitweb/?a=commitdiff_plain;h=HEAD;p=note.git extent test_init_note_store: test opening an existing database --- 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); } }