Album memory leak: new score objects created in loadScores() but never deleted
both Album::print() and Album::createScore() create new Score objects when calling Album::loadScores(), but never delete these created score objects.
I'm going to add a new function Album::deleteScores() unloadScores() which iterates over each AlbumItem and deletes the score object if it exists (which will call ~Scores()). Will need to call deleteScores() unloadScores() before every return in print() and createScore(). (EDIT: I think "unloadScores()" might be a little better of a name, because unfortunately both Album and AlbumItem classes contain an element with "score" in the name...also issues with "delete score" might sound like is deleting a score file...and also avoids other confusion with other Album:: function names...)
Not a major issue, unless running mscore continuously (e.g. server mode) and saving/printing tons of albums.
Note the implicit deconstructor for Album will call the deconstor for QList, which will delete each AlbumItem, but the implicit deconstor for AlbumItem itself will not delete the memory pointed to by Score* score.
Comments
(unrelated question: shouldn't album.cpp and album.h be moved inside /libmscore instead of /mscore directory, since album class deals with non-gui related aspects? Of course, albummanager class is appropriately part of the non-library mscore.)
https://github.com/musescore/MuseScore/pull/2230
I think in c17fa67 it got fixed by Werner
and e8aee8a
Fixed in e8aee8aa20
and in 2.0.3, 8a9b541103
Automatically closed -- issue fixed for 2 weeks with no activity.