Skip to content

Commit

Permalink
Eliminate unnecessary pointer usage
Browse files Browse the repository at this point in the history
  • Loading branch information
cbjeukendrup committed Feb 27, 2025
1 parent 11e8bc3 commit c6c5b76
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/engraving/api/v1/instrument.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ void Channel::setMidiBankAndProgram(int bank, int program, bool setUserBankContr
patch.prog = program;

mu::engraving::Score* score = _part->score();
score->undo(new ChangePatch(score, ch, &patch));
score->undo(new ChangePatch(score, ch, patch));

if (setUserBankController) {
score->undo(new SetUserBankController(ch, true));
Expand Down
4 changes: 2 additions & 2 deletions src/engraving/dom/undo.h
Original file line number Diff line number Diff line change
Expand Up @@ -757,8 +757,8 @@ class ChangePatch : public UndoCommand
void flip(EditData*) override;

public:
ChangePatch(Score* s, InstrChannel* c, const MidiPatch* pt)
: score(s), channel(c), patch(*pt) {}
ChangePatch(Score* s, InstrChannel* c, const MidiPatch& pt)
: score(s), channel(c), patch(pt) {}
UNDO_NAME("ChangePatch")
UNDO_CHANGED_OBJECTS({ score })
};
Expand Down
12 changes: 6 additions & 6 deletions src/engraving/tests/instrumentchange_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,12 @@ TEST_F(Engraving_InstrumentChangeTests, testMixer)
InstrumentChange* ic = static_cast<InstrumentChange*>(s->annotations()[0]);
int idx = score->staff(0)->channel(s->tick(), 0);
InstrChannel* c = score->staff(0)->part()->instrument(s->tick())->channel(idx);
MidiPatch* mp = new MidiPatch;
mp->bank = 0;
mp->drum = false;
mp->name = "Viola";
mp->prog = 41;
mp->synti = "Fluid";
MidiPatch mp;
mp.bank = 0;
mp.drum = false;
mp.name = "Viola";
mp.prog = 41;
mp.synti = "Fluid";
score->startCmd(TranslatableString::untranslatable("Instrument change tests"));
ic->setXmlText("Mixer Viola");
score->undo(new ChangePatch(score, c, mp));
Expand Down

0 comments on commit c6c5b76

Please sign in to comment.