--- /dev/null
+Return-Path: <polatel@gmail.com>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by olra.theworths.org (Postfix) with ESMTP id E0CC3431FB6\r
+ for <notmuch@notmuchmail.org>; Wed, 25 Apr 2012 13:23:08 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.699\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.699 tagged_above=-999 required=5\r
+ tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FROM=0.001,\r
+ RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+ by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id 9zb88ET1+eWn for <notmuch@notmuchmail.org>;\r
+ Wed, 25 Apr 2012 13:23:08 -0700 (PDT)\r
+Received: from mail-bk0-f53.google.com (mail-bk0-f53.google.com\r
+ [209.85.214.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id E7C71431FAE\r
+ for <notmuch@notmuchmail.org>; Wed, 25 Apr 2012 13:23:07 -0700 (PDT)\r
+Received: by bkcjk13 with SMTP id jk13so60902bkc.26\r
+ for <notmuch@notmuchmail.org>; Wed, 25 Apr 2012 13:23:06 -0700 (PDT)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
+ h=mime-version:sender:in-reply-to:references:from:date\r
+ :x-google-sender-auth:message-id:subject:to:cc:content-type\r
+ :content-transfer-encoding;\r
+ bh=Kyk3QG0106xKi6x3eoCKRSNAij6JjsibZO40sSoP9y8=;\r
+ b=xIba6HhckJyMwOOMvKOHVdThYTyquOGriY/9c00hneFbsQQ//3wdP4pqqxI5vrutlC\r
+ IWT5LcfDMP0C44F+rqvKdVggKozdYnCIIHGQqdH5vdBtqB6gYP/oK9lPBHEpkKLIpyQa\r
+ fb7ZNoDjSz6lI6lERs56jNqntKFvmeO/R+ep+kH0uzrFNu9Prg/L3YJdudGQiy7Yjr6e\r
+ n8VDFR/Hh4Aslx9M+GAslVa3SFns4u7BbfzwpIcu3SGnx/sbHDpVyMGndWCSQeJydLbC\r
+ Tuqn3CUtXc1KhzmoqJytfColsRqSWwduGIskluX0WVTJqSt/bEid+RoL5h2lCc7Q0+iz\r
+ qTHw==\r
+Received: by 10.204.128.152 with SMTP id k24mr1227434bks.127.1335385386343;\r
+ Wed, 25 Apr 2012 13:23:06 -0700 (PDT)\r
+MIME-Version: 1.0\r
+Sender: polatel@gmail.com\r
+Received: by 10.204.123.73 with HTTP; Wed, 25 Apr 2012 13:22:45 -0700 (PDT)\r
+In-Reply-To:\r
+ <CAMP44s2HbqaMxELGUJKZDaJx_pH9A1gqEJdiNPmvPjgGv79+Ow@mail.gmail.com>\r
+References: <1335185032-13075-1-git-send-email-felipe.contreras@gmail.com>\r
+ <CADv3eywAvyMuh3vWLwyuf0Ui_kskwp9875pGxCR1GTm7deN9Pg@mail.gmail.com>\r
+ <CAMP44s3SyU4WVV0_McHWseNL=jmMnAXO2EdZK4Xk-wrCHPVD8A@mail.gmail.com>\r
+ <CADv3eywb0tguYowTAK5Ag9YZ48zFZA0QJVNEj_cZcCpr-76Bbg@mail.gmail.com>\r
+ <CAMP44s0=m+PmVBdVytHaYujpaZu=2WH+1F_VoMzpfXH+SS_ZmQ@mail.gmail.com>\r
+ <CADv3eyxcu=2ZJ7GH3WULKMqe6FdmzhPtU6K9MLcCQ4m0cWmM7A@mail.gmail.com>\r
+ <CAMP44s2qmPWZk=1N8L1aOnDb7b81kthNB-Gj798wdwBdtbBjFQ@mail.gmail.com>\r
+ <20120424011528.GA12459@mit.edu>\r
+ <CAMP44s2HbqaMxELGUJKZDaJx_pH9A1gqEJdiNPmvPjgGv79+Ow@mail.gmail.com>\r
+From: Ali Polatel <alip@exherbo.org>\r
+Date: Wed, 25 Apr 2012 23:22:45 +0300\r
+X-Google-Sender-Auth: jelBXbfFdp37iBN03aPmVmsv9uw\r
+Message-ID:\r
+ <CADv3eyzevhzH8A9JXjzai5nk4Hc5vfKfNX2Tdbp5oRG6+Hwivw@mail.gmail.com>\r
+Subject: Re: [PATCH] ruby: make sure the database is closed\r
+To: Felipe Contreras <felipe.contreras@gmail.com>\r
+Content-Type: text/plain; charset=ISO-8859-1\r
+Content-Transfer-Encoding: quoted-printable\r
+Cc: notmuch@notmuchmail.org\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Wed, 25 Apr 2012 20:23:09 -0000\r
+\r
+2012/4/24 Felipe Contreras <felipe.contreras@gmail.com>:\r
+> On Tue, Apr 24, 2012 at 4:15 AM, Austin Clements <amdragon@mit.edu> wrote=\r
+:\r
+>> Quoth Felipe Contreras on Apr 24 at =A03:45 am:\r
+>>> On Tue, Apr 24, 2012 at 2:46 AM, Ali Polatel <alip@exherbo.org> wrote:\r
+>>> > 2012/4/24 Felipe Contreras <felipe.contreras@gmail.com>:\r
+>>>\r
+>>> >> Personally I don't see why an object, like say a query would remain\r
+>>> >> working correctly after the database is gone, either by calling\r
+>>> >> .close() directly, or just loosing the pointer to the original objec=\r
+t.\r
+>>> >> I don't think users would expect that, or, even if they somehow foun=\r
+d\r
+>>> >> it useful, that most likely would be very seldom, and hardly worth\r
+>>> >> worrying about it.\r
+>>> >\r
+>>> > Working correctly is not expected but wouldn't it be more appropriate\r
+>>> > to throw an exception rather than dumping core or printing on standar=\r
+d error?\r
+>>>\r
+>>> Sure, if that was possible.\r
+>>>\r
+>>> > I wonder whether we can make both work somehow.\r
+>>> > Maybe by using talloc explicitly and keeping reference pointers?\r
+>>> > I don't know whether it's worth bothering.\r
+>>>\r
+>>> Maybe, I don't see how, that's just not how C works. Maybe talloc does\r
+>>> have some way to figure out if a pointer has been freed, but I doubt\r
+>>> that, and I can't find it by grepping through the API.\r
+>>>\r
+>>> Another option would be hook into talloc's destructor so we know when\r
+>>> an object is freed and taint it, but then we would be overriding\r
+>>> notmuch's destructor, and there's no way around that (unless we tap\r
+>>> into talloc's internal structures). A way to workaround that would be\r
+>>> to modify notmuch's API so that we can specify a destructor for\r
+>>> notmuch objects, but that would be tedious, and I doubt a lof people\r
+>>> beside us would benefit from that.\r
+>>\r
+>> I believe (though I might be wrong) that bindings could simply\r
+>> maintain their own talloc references to C objects returned by\r
+>> libnotmuch to prevent them from being freed until the wrapper object\r
+>> is garbage collected. =A0This would require modifying all of the\r
+>> library's _destroy functions to use talloc_find_parent_bytype and\r
+>> talloc_unlink instead of simply calling talloc_free, but I don't think\r
+>> this change would be particularly invasive and it certainly wouldn't\r
+>> affect the library interface.\r
+>\r
+> That might work, but still, I don't see why this patch can't be applied.\r
+\r
+I don't have anything against applying this patch.\r
+If this fix has a kind of urgency -and I doubt it does- please get\r
+someone to push the patch.\r
+Below is my confirmation to accept the consequences:\r
+LGTM\r
+\r
+Otherwise, I'd rather we fix it properly most probably using the\r
+method described in Austin's previous mail.\r
+\r
+> Cheers.\r
+>\r
+> --\r
+> Felipe Contreras\r
+\r
+ -alip\r