From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31717 invoked by alias); 3 Mar 2014 06:02:51 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 31699 invoked by uid 89); 3 Mar 2014 06:02:50 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL,BAYES_00,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-yh0-f45.google.com Received: from mail-yh0-f45.google.com (HELO mail-yh0-f45.google.com) (209.85.213.45) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Mon, 03 Mar 2014 06:02:49 +0000 Received: by mail-yh0-f45.google.com with SMTP id i57so3162260yha.18 for ; Sun, 02 Mar 2014 22:02:47 -0800 (PST) MIME-Version: 1.0 X-Received: by 10.236.142.48 with SMTP id h36mr17789392yhj.49.1393826567412; Sun, 02 Mar 2014 22:02:47 -0800 (PST) Received: by 10.170.99.85 with HTTP; Sun, 2 Mar 2014 22:02:47 -0800 (PST) In-Reply-To: References: Date: Mon, 03 Mar 2014 06:02:00 -0000 Message-ID: Subject: Re: [PATCH] record_latest_value: Call release_value_or_incref instead of release_value From: Doug Evans To: "gdb-patches@sourceware.org" , =?ISO-8859-1?Q?Ludovic_Court=E8s?= Content-Type: text/plain; charset=ISO-8859-1 X-IsSubscribed: yes X-SW-Source: 2014-03/txt/msg00029.txt.bz2 On Sun, Mar 2, 2014 at 10:00 PM, Doug Evans wrote: > Hi. > > While testing a fix for bug 16612 I was getting segvs and traced it to > the new history-append! Scheme function. > > The underlying gdb value was getting prematurely freed when its > Scheme wrapper was garbage collected, but it was still in the value > history. > > I think this is because its reference counting is wrong. > Upon return from record_latest_value, its reference count is still one. > However it was one upon entry. It should be two, right? > One for the Scheme wrapper and one for the history entry. Apologies for the followup. I should have said "However it was one upon entry and the value had already been released." The value gets released when creating the Scheme wrapper.