Re: Pointer ownership

Subject: Re: Pointer ownership

Date: Mon, 17 Dec 2018 08:22:27 +0900

To: Dirk Van Haerenborgh, notmuch@notmuchmail.org

Cc:

From: David Bremner


Dirk Van Haerenborgh <vhdirk@gmail.com> writes:


> For instance, when iterating messages from a thread: Can one still use a
> notmuch_message_t* when the thread is destroyed?
> Are the individual
> messages 'owned' by the thread, or only by the query? Same question for
> 'replies'.
>
> Could someone please shed some light on this? I'd very much appreciate it.

It's hierarchical (the underlying allocator is talloc). So threads are
owned by the corresponding query, and messages are owned by threads.

Assuming replies refers to notmuch_message_get_replies, then those are
owned by some thread as well.

Threads are somewhat lazily constructed, so there's a time where a
message is owned by a query before it is "stolen" by a thread.

This is all Carl's design, so hopefully he'll correct me if I said
anything outrageously wrong.

d



_______________________________________________
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch

Thread: