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 7FC8D431FD9 for ; Mon, 23 Apr 2012 05:48:51 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.799 X-Spam-Level: X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=unavailable 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 boAjadw5OIhC for ; Mon, 23 Apr 2012 05:48:51 -0700 (PDT) Received: from mail-lpp01m010-f53.google.com (mail-lpp01m010-f53.google.com [209.85.215.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 52804431FD7 for ; Mon, 23 Apr 2012 05:48:50 -0700 (PDT) Received: by lahc1 with SMTP id c1so9220121lah.26 for ; Mon, 23 Apr 2012 05:48:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer; bh=kc5BhnESDswK35XfDdPa6FZJZbNEf/JduoaUlcRarmk=; b=bYRx1WlKPd7gZqeKEGb5kN8+Mh0ay0D8FdokJQRwBorvqyi3Bs3omTOug5caA/QvIu DL+N8l/8Q980ctT7XesGL+gobNfXIf9odx+1xZCbp/+ZWQLPB4/QSfV6LIJh0rutv7Qr My2qNJ/2V1b0WeOXMtTllvY2gxA6S5ophER2BBj5XgoXekPX+cF0vZez+WGIHJyX57mF 77BGtHGdmgX4CG5zb8iGWmfDMpF+HcmgW5uHqDHilUzhiMVJzaMJ6Vos8NBPUY+9b3ZZ f93cIIhlq01bo+oSCw+T8kUCmtdCZKBt9LuHHk4ZDwDYtgFR50aXOgQNW7ALOu+sleWY 40YQ== Received: by 10.112.36.66 with SMTP id o2mr7298904lbj.107.1335185328583; Mon, 23 Apr 2012 05:48:48 -0700 (PDT) Received: from localhost (81-197-42-53.elisa-mobile.fi. [81.197.42.53]) by mx.google.com with ESMTPS id ox7sm19776217lbb.17.2012.04.23.05.48.47 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 23 Apr 2012 05:48:47 -0700 (PDT) From: Felipe Contreras To: notmuch@notmuchmail.org Subject: [PATCH] ruby: make sure the database is closed Date: Mon, 23 Apr 2012 15:48:20 +0300 Message-Id: <1335185300-12950-1-git-send-email-felipe.contreras@gmail.com> X-Mailer: git-send-email 1.7.10 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: Mon, 23 Apr 2012 12:48:51 -0000 If the Ruby code does not manually close the database, we need to make sure it's closed when garbage collected. In Ruby, users are not _required_ to close, the garbage collector should take care of that. Signed-off-by: Felipe Contreras --- bindings/ruby/database.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/bindings/ruby/database.c b/bindings/ruby/database.c index 982fd59..7b2ed47 100644 --- a/bindings/ruby/database.c +++ b/bindings/ruby/database.c @@ -20,10 +20,16 @@ #include "defs.h" +static void +database_free (void *p) +{ + notmuch_database_close (p); +} + VALUE notmuch_rb_database_alloc (VALUE klass) { - return Data_Wrap_Struct (klass, NULL, NULL, NULL); + return Data_Wrap_Struct (klass, NULL, database_free, NULL); } /* -- 1.7.10