From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id EF3336DE0AB2 for ; Thu, 20 Dec 2018 01:11:21 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: -0.002 X-Spam-Level: X-Spam-Status: No, score=-0.002 tagged_above=-999 required=5 tests=[AWL=-0.001, SPF_PASS=-0.001] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id TXdlpymQPYj7 for ; Thu, 20 Dec 2018 01:11:19 -0800 (PST) Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197]) by arlo.cworth.org (Postfix) with ESMTPS id 1DA956DE0B2B for ; Thu, 20 Dec 2018 01:11:18 -0800 (PST) Received: from remotemail by fethera.tethera.net with local (Exim 4.89) (envelope-from ) id 1gZuMK-0004oq-6R; Thu, 20 Dec 2018 04:11:12 -0500 Received: (nullmailer pid 813 invoked by uid 1000); Sun, 16 Dec 2018 23:22:27 -0000 From: David Bremner To: Dirk Van Haerenborgh , notmuch@notmuchmail.org Subject: Re: Pointer ownership In-Reply-To: References: X-List-To: notmuch Date: Mon, 17 Dec 2018 08:22:27 +0900 Message-ID: <87imzt9hvw.fsf@tethera.net> MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Dec 2018 09:11:22 -0000 Dirk Van Haerenborgh 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