etternagame / etterna

Advanced cross-platform rhythm game focused on keyboard play
https://etternaonline.com/
MIT License
475 stars 134 forks source link

Replace RageUtil_AutoPtr with std smart pointers #1179

Closed nico-abram closed 1 year ago

nico-abram commented 2 years ago

I noticed a coverity scan defect in RageUtil_AutoPtr and when I looked at the file it looked like mostly a homegrown shared_ptr and unique_ptr, so this patch removes them and replaces them with those 2. When removing the file from cmake, I also found a TODO comment indicating they should be replaced with std smart pointers: "Utils/RageUtil_AutoPtr.h" # TODO: Remove the need for this and replace with c++11 smart pointers

There were 2 big differences these had with the std smart pointers:

I think I also fixed a memory leak in MusicWheel: It doesn't look like the elements of std::vector<MusicWheelItemData*> m__UnFilteredWheelItemDatas[NUM_SortOrder]; were ever being freed, and they were created by BuildWheelItemDatas via operator new.