Skip to content

Commit

Permalink
fix #278969: delete systems before measures on score destruction
Browse files Browse the repository at this point in the history
As layout-only objects systems need to correctly update the state of
the related measures and spanners on its destruction. For this
reason it may introduce freed memory writing if score is destroyed
in an incorrect order.
  • Loading branch information
dmitrio95 committed Dec 1, 2018
1 parent 76a22bd commit e85f3a2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion libmscore/score.cpp
Expand Up @@ -313,14 +313,15 @@ Score::~Score()
foreach(MuseScoreView* v, viewer)
v->removeScore();
// deselectAll();
qDeleteAll(_systems); // systems are layout-only objects so we delete
// them prior to measures.
for (MeasureBase* m = _measures.first(); m;) {
MeasureBase* nm = m->next();
delete m;
m = nm;
}
qDeleteAll(_parts);
qDeleteAll(_staves);
qDeleteAll(_systems);
// qDeleteAll(_pages); // TODO: check
_masterScore = 0;
}
Expand Down

0 comments on commit e85f3a2

Please sign in to comment.