]> uap-core.de Git - note.git/commitdiff
extent test_init_note_store: test opening an existing database main
authorOlaf Wintermann <olaf.wintermann@gmail.com>
Fri, 9 Jan 2026 13:34:13 +0000 (14:34 +0100)
committerOlaf Wintermann <olaf.wintermann@gmail.com>
Fri, 9 Jan 2026 13:34:13 +0000 (14:34 +0100)
application/store.c
application/tests/test-store.c

index f061cb2892e836838c58f5eac88722c7ee811eb1..74cd87a3653dd9230c897fd84a23305fb17732a8 100644 (file)
@@ -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;
 }
 
 
index 453cb6a34ab82b3cab58995cd49583ac0e5e369a..0beb76de060bd9ce43e95315efd007a9f6def2f2 100644 (file)
@@ -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);
     }
 }