From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 128835 invoked by alias); 2 Sep 2017 10:48:44 -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 128825 invoked by uid 89); 2 Sep 2017 10:48:44 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: smtp.polymtl.ca Received: from smtp.polymtl.ca (HELO smtp.polymtl.ca) (132.207.4.11) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 02 Sep 2017 10:48:39 +0000 Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id v82AmW2E028368 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sat, 2 Sep 2017 06:48:37 -0400 Received: by simark.ca (Postfix, from userid 112) id 3C5561EA24; Sat, 2 Sep 2017 06:48:32 -0400 (EDT) Received: from simark.ca (localhost [127.0.0.1]) by simark.ca (Postfix) with ESMTP id 78EE71E984; Sat, 2 Sep 2017 06:48:30 -0400 (EDT) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Sat, 02 Sep 2017 10:48:00 -0000 From: Simon Marchi To: Tom Tromey Cc: gdb-patches@sourceware.org Subject: Re: [RFA 3/3] Change counted_command_line to a shared_ptr In-Reply-To: <13f5b277e2bc200beafe7304791c32f5@polymtl.ca> References: <20170830220610.19718-1-tom@tromey.com> <20170830220610.19718-4-tom@tromey.com> <13f5b277e2bc200beafe7304791c32f5@polymtl.ca> Message-ID: <843aefc2fa977bad3d4b0e88dc0488de@polymtl.ca> X-Sender: simon.marchi@polymtl.ca User-Agent: Roundcube Webmail/1.3.0 X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Sat, 2 Sep 2017 10:48:32 +0000 X-IsSubscribed: yes X-SW-Source: 2017-09/txt/msg00013.txt.bz2 On 2017-09-01 22:48, Simon Marchi wrote: > On 2017-08-31 00:06, Tom Tromey wrote: >> This changes counted_command_line to be a typedef for std::shared_ptr >> and removes the associated cleanups. In the long run I believe that >> cmd_list_element should also be changed to use a shared_ptr. > > The command_line object is currently freed using free_command_lines. > The shared_ptr will "delete" it. It seems to me that some > C++ification of the command_line structure needs to happen for it to > get de-allocated properly. Hi Tom, I looked at this more and found that free_command_lines was indeed being called when the shared_ptr free'd its pointer. I finally understood that when assigning: a_shared_ptr = a_unique_ptr; like commands_command_1 does, for example, the deleter is also transferred. Simon