notmuch: manually close notmuch objects

There seems to be some race with the automatic closing that should happen
in theory... close it manually where we can to avoid the issue
This commit is contained in:
Reto Brunner 2020-08-07 09:49:47 +02:00
parent 1023dd9588
commit 7a9fe3824f
1 changed files with 3 additions and 0 deletions

View File

@ -122,10 +122,12 @@ func (db *DB) MsgIDsFromQuery(q string) ([]string, error) {
if err != nil {
return err
}
defer query.Close()
msgs, err := query.Messages()
if err != nil {
return err
}
defer msgs.Close()
var msg *notmuch.Message
for msgs.Next(&msg) {
msgIDs = append(msgIDs, msg.ID())
@ -189,6 +191,7 @@ func (db *DB) MsgTags(key string) ([]string, error) {
}
defer msg.Close()
ts := msg.Tags()
defer ts.Close()
var tag *notmuch.Tag
for ts.Next(&tag) {
tags = append(tags, tag.Value)