Thread Previous • Date Previous • Date Next • Thread Next |
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. A change back would violate that, and over time old code should be updated. With these leaks you see what happens if you pass around raw pointers and communicate the intent only through comments (The comment on GetNewComment explicitly stated the caller is responsible for deleting the returned object).- 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.
Thread Previous • Date Previous • Date Next • Thread Next |