From 9262a27382c8fd294ec6ded796095425928d2c0a Mon Sep 17 00:00:00 2001 From: Jameson Graef Rollins Date: Sat, 19 May 2012 13:42:11 +1700 Subject: [PATCH] Re: [PATCH v2 5/5] cli: lazily create the crypto gpg context only when needed --- 6e/104a396209aa8795f7249430a63ee671d4322d | 112 ++++++++++++++++++++++ 1 file changed, 112 insertions(+) create mode 100644 6e/104a396209aa8795f7249430a63ee671d4322d diff --git a/6e/104a396209aa8795f7249430a63ee671d4322d b/6e/104a396209aa8795f7249430a63ee671d4322d new file mode 100644 index 000000000..be6cedff3 --- /dev/null +++ b/6e/104a396209aa8795f7249430a63ee671d4322d @@ -0,0 +1,112 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id DB8CA431FB6 + for ; Fri, 18 May 2012 13:42:17 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -2.29 +X-Spam-Level: +X-Spam-Status: No, score=-2.29 tagged_above=-999 required=5 + tests=[RCVD_IN_DNSWL_MED=-2.3, T_MIME_NO_TEXT=0.01] autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id LXdjAWI1rv2x for ; + Fri, 18 May 2012 13:42:16 -0700 (PDT) +Received: from outgoing-mail.its.caltech.edu (outgoing-mail.its.caltech.edu + [131.215.239.19]) + by olra.theworths.org (Postfix) with ESMTP id 39AE7431FAE + for ; Fri, 18 May 2012 13:42:16 -0700 (PDT) +Received: from fire-doxen.imss.caltech.edu (localhost [127.0.0.1]) + by fire-doxen-postvirus (Postfix) with ESMTP id A63332E50B63; + Fri, 18 May 2012 13:42:15 -0700 (PDT) +X-Spam-Scanned: at Caltech-IMSS on fire-doxen by amavisd-new +Received: from finestructure.net (rrcs-24-103-26-131.nyc.biz.rr.com + [24.103.26.131]) (Authenticated sender: jrollins) + by fire-doxen-submit (Postfix) with ESMTP id D018D32806F; + Fri, 18 May 2012 13:42:12 -0700 (PDT) +Received: by finestructure.net (Postfix, from userid 1000) + id A8EBF4AD; Fri, 18 May 2012 13:42:11 -0700 (PDT) +From: Jameson Graef Rollins +To: Daniel Kahn Gillmor , + Notmuch Mail +Subject: Re: [PATCH v2 5/5] cli: lazily create the crypto gpg context only + when needed +In-Reply-To: <4FB6B2F5.6090105@fifthhorseman.net> +References: <1337362357-31281-1-git-send-email-jrollins@finestructure.net> + <1337362357-31281-2-git-send-email-jrollins@finestructure.net> + <1337362357-31281-3-git-send-email-jrollins@finestructure.net> + <1337362357-31281-4-git-send-email-jrollins@finestructure.net> + <1337362357-31281-5-git-send-email-jrollins@finestructure.net> + <1337362357-31281-6-git-send-email-jrollins@finestructure.net> + <20120518192157.GV11804@mit.edu> + <87txzd9su3.fsf@servo.finestructure.net> + <4FB6B2F5.6090105@fifthhorseman.net> +User-Agent: Notmuch/0.12+183~g9d5ff3c (http://notmuchmail.org) Emacs/23.4.1 + (x86_64-pc-linux-gnu) +Date: Fri, 18 May 2012 13:42:11 -0700 +Message-ID: <87ehqh9q70.fsf@servo.finestructure.net> +MIME-Version: 1.0 +Content-Type: multipart/signed; boundary="=-=-="; + micalg=pgp-sha256; protocol="application/pgp-signature" +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +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: Fri, 18 May 2012 20:42:18 -0000 + +--=-=-= + +On Fri, May 18 2012, Daniel Kahn Gillmor 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. + +--=-=-= +Content-Type: application/pgp-signature + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.12 (GNU/Linux) + +iQIcBAEBCAAGBQJPtrQjAAoJEO00zqvie6q8nOMQAIxUhK6waeFE0Y9UbJNAezt6 +TKWu3UKV7Q9aBQgoJc3GjzR96qwx6i5Rma9n7CoZeNgNRl8qPd9hIzRRToWClJ6D +N/KaPtJwikbO1CSBgn3kfzaH4rS4F1HACZIqLM7mDiBLlL47dMfh2v41ixWaqlyX +R2ndkHL/Aer820/guhlnIKy+sKHJa7zFxsrJghlhqrEHyDomWrteCnzhXF+3AgRb +MXVNc/tXxBXE734ohkWPYT9mIMlwiInoEfSWdgMuoh7FOUXZEpPfvcfJFjq4PyUE +NfjJA3omFUZHGcJdeSz/eU5ArdPfUJ+0HDxVmH0vkekI8gtsPTiW8ib3ctnjuKud +bPtaumed71rJC0VGu5LEz+SiYz+6ievB9ZEvuW5liTJl2hUUixqD5RPvFk/kubKI +SLKa7Xp1qet84moI696jhrBWESz8jJTnM96TuWZMuUHGGeLh/ipQLbar3ZyThuUC +BtH5C4zqxtsw1jtz5Zrhz98IzLBtmvwuEFt33Vk6EhijoqImlAUPvq4E9CMrWh8i +pvF0sxd9o6LsdjZdUOzJ5lxlwLqqUdfYnmr047WjcosJJnajOoCjIYRPrk+LVWee +xuStWV/wiv/prp4d0k0KzKIzWOQVWmsvfNE2zUdTS2SG9zUOVWrWi2vhRKtSFbHs +Cz9kUhDLyEZpWgZI8Hu4 +=5xLB +-----END PGP SIGNATURE----- +--=-=-=-- -- 2.26.2