David Bremner <da...@tethera.net> writes: > Lars Luthman <deb-b...@larsluthman.net> writes: > > >> This should either be fixed so it doesn't crash, as documented, or the >> documentation should be changed to describe which functions are unsafe >> to call after notmuch_database_close(). >> > > The obvious thing to do is just say that any function other than > notmuch_database_destroy has undefined behaviour after calling > notmuch_database_close.
Reading the docs again more carefully, it doesn't actually suggest that you can call functions on the database itself, but only documents the behaviour on derived objects like messages. I agree the docs could be more explicit, and I'll probably apply something like the attached upstream. It doesn't seem very urgent to fix the bug in Debian though, certainly not urgent enough for an update in stable.
>From 78dc819a0ced2f56537a6cbb79006ab1316093d4 Mon Sep 17 00:00:00 2001 From: David Bremner <da...@tethera.net> Date: Mon, 27 Jun 2016 20:35:01 +0200 Subject: [PATCH] doc: forbid further operations on a closed database We could add many null pointer checks, but currently I don't see a use case that justifies it. --- lib/notmuch.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/notmuch.h b/lib/notmuch.h index d4a97cb..2faa146 100644 --- a/lib/notmuch.h +++ b/lib/notmuch.h @@ -332,7 +332,9 @@ notmuch_database_status_string (const notmuch_database_t *notmuch); * functions on objects derived from this database may either behave * as if the database had not been closed (e.g., if the required data * has been cached) or may fail with a - * NOTMUCH_STATUS_XAPIAN_EXCEPTION. + * NOTMUCH_STATUS_XAPIAN_EXCEPTION. The only further operation + * permitted on the database itself is to call + * notmuch_database_destroy. * * notmuch_database_close can be called multiple times. Later calls * have no effect. -- 2.8.1