Brewtarget / brewtarget

Main brewtarget source code repository.
GNU General Public License v3.0
312 stars 134 forks source link

Fix for Mash Designer problems (https://github.com/Brewtarget/brewtarget/issues/620) #638

Closed matty0ung closed 2 years ago

matty0ung commented 2 years ago

There were a few places where we were still trying to do things directly with MashStep objects rather than just giving them to the owning Mash and letting all the logic be centralised in Mash::addMashStep(). Similarly, part of the original bug was trying to grab some info from a newly-created MashStep before it had been added to the Mash. We now just wait for the Mash to tell us about changes to its MashSteps, per comment in src/tableModels/MashStepTableModel.cpp

Switched more of the code to use shared pointers which removes some memory leaks and makes undelete work even on things that have been "hard" deleted (because the shared pointer keeps the object in existence even after it was removed from the ObjectStore).

Tried to remove some of the duplicated code from the files in the tableModels directory, though there are some limitations about what we can do here with the Qt MOC not being able to handle C++ templates (see comment in tableModels/BtTableModel.h

matty0ung commented 2 years ago

Need an extra include or two for Mac build - will add this weekend!

matty0ung commented 2 years ago

Since it's been a few weeks there are folks waiting on this fix, I'm going to merge it. If anyone does want to do a code review then, obviously, that would be great to have, even subsequent to the merge, and I can incorporate feedback into an upcoming patch.