<div dir="ltr">Thanks,<div><br></div><div>The documentation regarding lifetime of pointers is indeed at some points rather limited.<br>Is there ever a need for calling thread/message_destroy?</div><div><br></div><div>From what I understood, lifetime is like this:<br>Database > Query > Threads > Thread > Messages > Message</div><div><br></div><div>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.</div><div><br></div><div>Can someone clarify this for me? It would simplify things a lot in notmuch-rs.</div><div><br></div><div>-Dirk</div></div><br><div class="gmail_quote"><div dir="ltr">On Mon, 19 Nov 2018 at 00:34, David Bremner <<a href="mailto:david@tethera.net">david@tethera.net</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Dirk Van Haerenborgh <<a href="mailto:dirk.vanhaerenborgh@senso2.me" target="_blank">dirk.vanhaerenborgh@senso2.me</a>> writes:<br>
<br>
<br>
> This is not a typo. I deliberately duplicated that bit.<br>
> The second time it runs that loop, it will always segfault, unless you<br>
> omit the first 'notmuch_message_destroy' call.<br>
><br>
> Given your example, I suspect the Python3 bindings to do something very<br>
> similar. I would think that this is the correct way to use the API?<br>
><br>
> Kind regards,<br>
> -Dirk<br>
<br>
Unless I misremember / misunderstand something, calling<br>
notmuch_message_destroy is not a good idea, unless you are going to<br>
recreate the thread object. The thread has an internal list of messages,<br>
which you are freeing.<br>
<br>
Possibly the documentation could be improved on this point.<br>
<br>
d<br>
</blockquote></div>