← Back to team overview

kicad-developers team mailing list archive

Re: Bug fixing and Coverity scan errors.

 

On 31 March 2015 at 21:53, Wayne Stambaugh <stambaughw@xxxxxxxxx> wrote:
> On 3/31/2015 4:03 PM, Simon Richter wrote:
>> Hi,
>>
>> On 31.03.2015 13:29, Brian Sidebotham wrote:
>>
>>>     delete m_model;
>>
>>> should really be:
>>
>>>     delete m_model;
>>>     m_model = NULL;
>>
>>> Other functions (namely read_DEF) make assignment from m_model. It's
>>> too complicated to try and rely on knowing the logical order of
>>> functions in a file format parser to guarantee that it won't break. At
>>> least if the assignment from m_model assigns NULL, debugging is
>>> reasonably sane.
>>
>> I'd rather like to see a smart pointer instead.
>>
>> If my object deletes another object, this implies that it has a rough
>> idea of the ownership semantics, but these are never explicitly spelled
>> out. auto_ptr/unique_ptr could then be used to denote exclusive
>> ownership, shared_ptr for shared ownership, or intrusive_ptr for
>> reference counted objects with internal counters. Naked pointers could
>> then mean "no ownership".
>>
>>    Simon
>
> This is my preference as well.  Although I would veto unique_ptr for
> now.  I'm not ready to make kicad c++ 0x11 compliant yet.
>

Yep, I also think that sounds like a better plan! I'll fix CID 108646
using auto_ptr then.

Thanks Simon.

Best Regards,

Brian.


References