Re: [PATCH v2 5/5] cli: lazily create the crypto gpg context only when needed

Subject: Re: [PATCH v2 5/5] cli: lazily create the crypto gpg context only when needed

Date: Fri, 18 May 2012 13:42:11 -0700

To: Daniel Kahn Gillmor, Notmuch Mail

Cc:

From: Jameson Graef Rollins


On Fri, May 18 2012, Daniel Kahn Gillmor <dkg@fifthhorseman.net> wrote:
> You could provide a "destructor" function for notmuch_crypto_t, which
> whoever is responsible for the struct would need to call when they are
> ready to dispose of it.
>
> The destructor would just destroy any GMIME crypto contexts pointed to
> by the struct, and reset those pointers to NULL.

That sounds reasonable.  I'll see if I can hack something like that.

> Since the common workflow is a singleton notmuch_crypto_t that is a
> subobject of the singleton notmuch_params_t, you could just call that
> destructor function before the notmuch_params_t falls out of scope.

Just to be clear, notmuch_crypto_t is not only used as a subobject of
notmuch_show_params_t.  At least in what I submitted it is used on it's
own in notmuch-reply.c, in place of notmuch_show_params_t, since the
reply code was only using the crypto context to decrypt messages being
replied to.  So it's probably best to handle it independently of
notmuch_show_params_t.

jamie.
part-000.sig (application/pgp-signature)

Thread: