This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA 3/3] Change counted_command_line to a shared_ptr
- From: Tom Tromey <tom at tromey dot com>
- To: Simon Marchi <simon dot marchi at polymtl dot ca>
- Cc: Tom Tromey <tom at tromey dot com>, gdb-patches at sourceware dot org
- Date: Sat, 02 Sep 2017 09:07:06 -0600
- Subject: Re: [RFA 3/3] Change counted_command_line to a shared_ptr
- Authentication-results: sourceware.org; auth=none
- References: <20170830220610.19718-1-tom@tromey.com> <20170830220610.19718-4-tom@tromey.com> <13f5b277e2bc200beafe7304791c32f5@polymtl.ca> <843aefc2fa977bad3d4b0e88dc0488de@polymtl.ca>
>>>>> "Simon" == Simon Marchi <simon.marchi@polymtl.ca> writes:
Simon> I looked at this more and found that free_command_lines was indeed
Simon> being called when the shared_ptr free'd its pointer. I finally
Simon> understood that when assigning:
Simon> a_shared_ptr = a_unique_ptr;
Simon> like commands_command_1 does, for example, the deleter is also
Simon> transferred.
Yeah, I should probably have mentioned that. I had to read about it
too, but then I think I had forgotten about it by the time I sent the
patch. I don't really understand why unique_ptr and shared_ptr differ
in this way; if you know the rationale I'd be interested in learning it.
Tom