Conversation
martukas
left a comment
There was a problem hiding this comment.
Sorry it took me a while to take a look at this. Hope you are still around? A few issues I noticed, but thanks, all of this looks like worthwhile improvements!
| LevelItem *levrend = new LevelItem(level, LevelItem::DaughterLevelType, | ||
| parentpos_, visual_settings_, scene_); | ||
| connectItem(levrend); | ||
| delete daughter_levels_[level.energy()]; |
There was a problem hiding this comment.
should we check to make sure it's non-null before deleting it?
There was a problem hiding this comment.
Thanks for the review!
if it's null, delete nullptr is a no-op, so it's not really necessary to check for it?
There was a problem hiding this comment.
Any way to use RAII here to avoid having deletes alltogether? I don't recall how the Qt patterns might constrain this.
| { | ||
| FeedingArrow* feed = new FeedingArrow(level, parentpos_, visual_settings_, scene_); | ||
| connectItem(feed); | ||
| delete feeding_arrows_[level.energy()]; |
| LevelItem *levrend = new LevelItem(level, LevelItem::DaughterLevelType, | ||
| parentpos_, visual_settings_, scene_); | ||
| connectItem(levrend); | ||
| delete daughter_levels_[level.energy()]; |
There was a problem hiding this comment.
Thanks for the review!
if it's null, delete nullptr is a no-op, so it's not really necessary to check for it?
This fixes the nullptr access reported in #22 (not yet the memleaks)