← Back to team overview

kicad-developers team mailing list archive

Re: [PATCH] Fix memory leaks with improper wxBaseConfig* usage (model ownership and ownership-transfer with std::unique_ptr)

 

Hi,

On 28.06.2016 00:30, Michael Steinberg wrote:

>>> -        wxConfigBase* config = GetNewConfig( fn.GetFullPath() );
>>> +        auto config = GetNewConfig( fn.GetFullPath() );
>>>           config->Write( HOTKEYS_CONFIG_KEY, msg );
>>> -        delete config;

>> This has subtle potential for errors -- while I'm normally in favour of
>> using "auto", spelling it out would help here in case the function
>> signature is changed back.

> Yes, I can see the risk. I'd ideally ask for the coding guide to
> explicitly state that raw pointers are not allowed in new code where
> ownership-transfers happens.

I'd be in favour of that.

> A change back would violate that, and over
> time old code should be updated.

Indeed, but that's still something we need to catch in review then.

   Simon

Attachment: signature.asc
Description: OpenPGP digital signature


References