fixed review issues

This commit is contained in:
Igor Korsukov 2020-03-21 11:39:23 +02:00
parent 11f7060e2d
commit 1927fae645
3 changed files with 18 additions and 8 deletions

View file

@ -538,7 +538,7 @@ static Fraction readCapVoice(Score* score, CapVoice* cvoice, int staffIdx, const
//
Fraction startTick = tick;
Tuplet* tuplet = 0;
Tuplet* tuplet = nullptr;
int tupletCount = 0;
bool tuplettrp = false;
bool tupletprol = false;
@ -559,7 +559,7 @@ static Fraction readCapVoice(Score* score, CapVoice* cvoice, int staffIdx, const
TDuration d;
d.setVal(ticks.ticks());
if (o->count) {
if (tuplet == 0) {
if (tuplet == nullptr) {
tupletCount = o->count;
tuplettrp = o->tripartite;
tupletprol = o->isProlonging;
@ -616,7 +616,10 @@ static Fraction readCapVoice(Score* score, CapVoice* cvoice, int staffIdx, const
if (tuplet) {
if (++nTuplet >= tupletCount) {
tick = tupletTick + tuplet->actualTicks();
delete tuplet;
//! NOTE If the tuplet is not added anywhere, then delete it
if (tuplet->elements().empty())
delete tuplet;
tuplet = nullptr;
}
else {
@ -641,7 +644,7 @@ static Fraction readCapVoice(Score* score, CapVoice* cvoice, int staffIdx, const
bool isgracenote = (!(o->invisible) && (ticks.isZero()));
if (o->count) {
if (tuplet == 0) {
if (tuplet == nullptr) {
tupletCount = o->count;
tuplettrp = o->tripartite;
tupletprol = o->isProlonging;
@ -797,7 +800,10 @@ static Fraction readCapVoice(Score* score, CapVoice* cvoice, int staffIdx, const
if (tuplet) {
if (++nTuplet >= tupletCount) {
tick = tupletTick + tuplet->actualTicks();
delete tuplet;
//! NOTE If the tuplet is not added anywhere, then delete it
if (tuplet->elements().empty())
delete tuplet;
tuplet = nullptr;
}
else {

View file

@ -163,9 +163,9 @@ void ScoreView::endEdit()
_score->addRefresh(editData.element->canvasBoundingRect());
for (int i = 0; i < editData.grips; ++i)
score()->addRefresh(editData.grip[i]);
editData.element->endEdit(editData);
//! NOTE After endEdit, the element may be null
if (editData.element) {
editData.element->endEdit(editData);
_score->addRefresh(editData.element->canvasBoundingRect());
ElementType tp = editData.element->type();
if (tp == ElementType::LYRICS)

View file

@ -37,8 +37,12 @@ void MuseScore::createNewWorkspace()
void MuseScore::editWorkspace()
{
if (WorkspacesManager::currentWorkspace() && !WorkspacesManager::currentWorkspace()->readOnly())
if (!WorkspacesManager::currentWorkspace())
return;
if (WorkspacesManager::currentWorkspace()->readOnly())
return;
if (!_workspaceDialog)
_workspaceDialog = new WorkspaceDialog();