segfault using python bindings
Dirk Van Haerenborgh
vhdirk at gmail.com
Mon Nov 19 01:09:46 PST 2018
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 <david at tethera.net> wrote:
> Dirk Van Haerenborgh <dirk.vanhaerenborgh at senso2.me> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20181119/3b15a0d8/attachment.html>
More information about the notmuch
mailing list