Thanks,

The documentation regarding lifetime of pointers is indeed at some points
rather limited.
Is there ever a need for calling thread/message_destroy?

>From what I understood, lifetime is like this:
Database > Query > Threads > Thread > Messages > Message

I assumed that destroying a 'Message' would only invalidate it for the
'Messages' iterator. Given that you can't destroy a message without
invalidating it for the Thread itself, it seems weird that the
documentation states that the 'Message' is only valid for the lifetime of
the iterator.

Can someone clarify this for me? It would simplify things a lot in
notmuch-rs.

-Dirk

On Mon, 19 Nov 2018 at 00:34, David Bremner <[email protected]> wrote:

> Dirk Van Haerenborgh <[email protected]> writes:
>
>
> > This is not a typo. I deliberately duplicated that bit.
> > The second time it runs that loop, it will always segfault, unless you
> > omit the first 'notmuch_message_destroy' call.
> >
> > Given your example, I suspect the Python3 bindings to do something very
> > similar. I would think that this is the correct way to use the API?
> >
> > Kind regards,
> > -Dirk
>
> Unless I misremember / misunderstand something, calling
> notmuch_message_destroy is not a good idea, unless you are going to
> recreate the thread object. The thread has an internal list of messages,
> which you are freeing.
>
> Possibly the documentation could be improved on this point.
>
> d
>
_______________________________________________
notmuch mailing list
[email protected]
https://notmuchmail.org/mailman/listinfo/notmuch

Reply via email to