[RFA 3/3] Change counted_command_line to a shared_ptr

Tom Tromey tom@tromey.com
Sat Sep 2 15:31:00 GMT 2017


>>>>> "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



More information about the Gdb-patches mailing list