unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Dirk Van Haerenborgh <vhdirk@gmail.com>
To: david@tethera.net
Cc: notmuch@notmuchmail.org
Subject: Re: segfault using python bindings
Date: Mon, 19 Nov 2018 10:09:46 +0100	[thread overview]
Message-ID: <CAHQqoqMyVtK+Yt0tsz3NFTSN80-0c0_KD3Rz1UcbueTZptVsRw@mail.gmail.com> (raw)
In-Reply-To: <87muq6t0xt.fsf@tethera.net>

[-- Attachment #1: Type: text/plain, Size: 1451 bytes --]

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@tethera.net> wrote:

> Dirk Van Haerenborgh <dirk.vanhaerenborgh@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
>

[-- Attachment #2: Type: text/html, Size: 2033 bytes --]

      reply	other threads:[~2018-11-19  9:10 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-09 14:49 segfault using python bindings David Čepelík
2018-11-11 20:16 ` David Bremner
2018-11-11 20:21   ` Gaute Hope
2018-11-15 21:13   ` Floris Bruynooghe
2018-11-16  4:44     ` Brian May
2018-11-16 10:29       ` David Bremner
2018-11-16 21:39         ` Floris Bruynooghe
2018-11-17  0:15           ` David Bremner
2018-11-16 10:27     ` David Bremner
2018-11-16 12:15       ` Daniel Kahn Gillmor
2018-11-16 22:07         ` Floris Bruynooghe
2019-08-14 19:20     ` David Bremner
2019-08-15  9:53       ` Floris Bruynooghe
2019-08-15 12:28         ` David Bremner
2019-08-20 17:20           ` Floris Bruynooghe
2019-08-21 16:02             ` Daniel Kahn Gillmor
2019-08-22 19:24               ` David Bremner
2019-08-22 19:37                 ` Rollins, Jameson
2019-08-23  0:09                   ` David Bremner
2019-08-23  1:59                   ` Daniel Kahn Gillmor
2019-08-23 12:07                     ` David Bremner
2019-08-23 20:43                       ` Daniel Kahn Gillmor
2019-08-23 22:58                         ` Rollins, Jameson
2019-08-26 17:09               ` Floris Bruynooghe
2019-08-26 17:28                 ` David Bremner
2018-11-18 20:22 ` Dirk Van Haerenborgh
2018-11-18 23:34   ` David Bremner
2018-11-19  9:09     ` Dirk Van Haerenborgh [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAHQqoqMyVtK+Yt0tsz3NFTSN80-0c0_KD3Rz1UcbueTZptVsRw@mail.gmail.com \
    --to=vhdirk@gmail.com \
    --cc=david@tethera.net \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).