Skip to content

Commit 2c6bf79

Browse files
don't send notifications in random order
1 parent fdca33e commit 2c6bf79

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/notation/internal/notationparts.cpp

+13-2
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,9 @@ void NotationParts::updatePartsAndSystemObjectStaves(const mu::engraving::ScoreC
385385
m_systemObjectStavesChanged.notify();
386386
}
387387

388+
std::vector<Staff*> removedStaves;
389+
std::vector<Staff*> addedStaves;
390+
388391
for (auto& pair : range.changedItems) {
389392
if (!pair.first || !pair.first->isStaff()) {
390393
continue;
@@ -393,11 +396,19 @@ void NotationParts::updatePartsAndSystemObjectStaves(const mu::engraving::ScoreC
393396
Staff* staff = toStaff(pair.first);
394397

395398
if (muse::contains(pair.second, CommandType::RemoveStaff)) {
396-
notifyAboutStaffRemoved(staff);
399+
removedStaves.push_back(staff);
397400
} else if (muse::contains(pair.second, CommandType::InsertStaff)) {
398-
notifyAboutStaffAdded(staff);
401+
addedStaves.push_back(staff);
399402
}
400403
}
404+
405+
for (Staff* staff : removedStaves) {
406+
notifyAboutStaffRemoved(staff);
407+
}
408+
409+
for (Staff* staff: addedStaves) {
410+
notifyAboutStaffAdded(staff);
411+
}
401412
}
402413

403414
void NotationParts::doSetScoreOrder(const ScoreOrder& order)

0 commit comments

Comments
 (0)