node-mapnik icon indicating copy to clipboard operation
node-mapnik copied to clipboard

Remove C Style Pointers

Open flippmoke opened this issue 10 years ago • 1 comments
trafficstars

Through out the code especially when using closure's, C style pointers are used. To bring node-mapnik up to the style requirements with Mapnik core we should modify these pointers to either use shared_ptrs or unique_ptrs. This is ideal so that we do not ever have a situation where we unknowingly allow for a memory leak by failing to delete a closure object.

flippmoke avatar Jul 27 '15 18:07 flippmoke

:+1: - all the C style stuff dates to my earliest attempts to learn how to write node C++ modules. Now that we've got C++11 on our side, this would be a fabulous thing to clean up. I made an attempt in a few places to use scope guards (just to avoid the error prone delete usage when argument validation fails), but I agree that unique pointers would probably be better (to avoid the delete used in the AfterSomething callbacks).

springmeyer avatar Jul 27 '15 19:07 springmeyer