widelands-dev team mailing list archive
-
widelands-dev team
-
Mailing list archive
-
Message #01013
Re: [Merge] lp:~csirkeee/widelands/memory-leaks-2 into lp:widelands
nooo, do not pass around shared_ptr's please - they support bad design as they delute the question who has ownership. And this question is not gone with them - they do not add garbage collection to c++. Please don't.
I support using smart pointers (for the moment scoped_ptr) in most places, but it is (nearly) never a good idea to pass them around. Instead pass around basic pointers and the one owner can hold a scoped_ptr or a unique_ptr (in the future, i guess). shared_ptr's are very rarely a good idea imho.
I only had a very quick look at the code an it looks good to me. Cmd_LuaCoroutine could have a scoped_ptr instead of m_cr. Use .realease when you give up ownership.
Otherwise I agree with nicolai - except for the shared_ptrs.
--
https://code.launchpad.net/~csirkeee/widelands/memory-leaks-2/+merge/150290
Your team Widelands Developers is requested to review the proposed merge of lp:~csirkeee/widelands/memory-leaks-2 into lp:widelands.
References