Merge pull request #960 from mgavioli/Fix_25958_EditStaff_crash_on_some_props_change

Fix #25958 - Crash when [Apply]ing and [OK]ing some prop changes
This commit is contained in:
Nicolas Froment 2014-06-07 10:22:23 +02:00
commit 81d86f6108
3 changed files with 17 additions and 10 deletions

View file

@ -672,7 +672,8 @@ void InstrumentData::setDrumset(Drumset* ds)
void InstrumentData::setLongName(const QString& f)
{
_longNames.clear();
_longNames.append(StaffName(f, 0));
if (f.length() > 0)
_longNames.append(StaffName(f, 0));
}
//---------------------------------------------------------
@ -682,7 +683,8 @@ void InstrumentData::setLongName(const QString& f)
void InstrumentData::setShortName(const QString& f)
{
_shortNames.clear();
_shortNames.append(StaffName(f, 0));
if (f.length() > 0)
_shortNames.append(StaffName(f, 0));
}
//---------------------------------------------------------

View file

@ -2361,6 +2361,9 @@ void ChangeStaffType::redo()
StaffType st = *staff->staffType();
staff->setStaffType(&staffType);
staffType = st;
Score* score = staff->score();
score->setLayoutAll(true);
score->scanElements(0, notifyTimeSigs);
}
void ChangeStaffType::undo()
@ -2397,6 +2400,8 @@ void ChangeStaffType::undo()
seg->add(clef);
}
// cmdUpdateNotes(); // needed?
score->setLayoutAll(true);
score->scanElements(0, notifyTimeSigs);
}
//---------------------------------------------------------

View file

@ -114,15 +114,15 @@ void EditStaff::updateInstrument()
{
updateInterval(instrument.transpose());
QList<StaffName>& nl = instrument.shortNames();
QString df = nl.isEmpty() ? "" : nl[0].name;
QList<StaffName>& snl = instrument.shortNames();
QString df = snl.isEmpty() ? "" : snl[0].name;
shortName->setText(df);
nl = instrument.longNames();
df = nl.isEmpty() ? "" : nl[0].name;
QList<StaffName>& lnl = instrument.longNames();
df = lnl.isEmpty() ? "" : lnl[0].name;
longName->setText(df);
if (partName->text() == instrumentName->text()) // Updates part name is no custom name has been set before
if (partName->text() == instrumentName->text()) // Updates part name if no custom name has been set before
partName->setText(instrument.trackName());
instrumentName->setText(instrument.trackName());
@ -191,14 +191,14 @@ void EditStaff::bboxClicked(QAbstractButton* button)
case QDialogButtonBox::RejectRole:
close();
if (staff != nullptr)
delete staff;
break;
default:
qDebug("EditStaff: unknown button %d", int(br));
break;
}
if (staff != nullptr)
delete staff;
}
//---------------------------------------------------------
@ -245,7 +245,7 @@ void EditStaff::apply()
}
if (s != staff->small() || inv != staff->invisible() || userDist != staff->userDist() || col != staff->color())
score->undo(new ChangeStaff(staff, s, inv, userDist * score->spatium(), col));
score->undo(new ChangeStaff(orgStaff, s, inv, userDist * score->spatium(), col));
if ( !(*orgStaff->staffType() == *staff->staffType()) ) {
// updateNeeded |= (orgStaff->staffGroup() == StaffGroup::TAB || staff->staffGroup() == StaffGroup::TAB);