Skip to content

Commit

Permalink
Remove unused parameter isCmdFromInspector from Score::endCmd
Browse files Browse the repository at this point in the history
And therewith probably fixed bug in scorefile.cpp:279.
  • Loading branch information
cbjeukendrup authored and igorkorsukov committed Jun 30, 2021
1 parent 1dca155 commit 00c603c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
16 changes: 9 additions & 7 deletions src/engraving/libmscore/cmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
#include "tremolo.h"
#include "rehearsalmark.h"
#include "sym.h"
#include "log.h"

using namespace mu;

Expand Down Expand Up @@ -273,13 +274,14 @@ void Score::undoRedo(bool undo, EditData* ed)
/// and (always) updating the redraw area.
//---------------------------------------------------------

void Score::endCmd(const bool isCmdFromInspector, bool rollback)
void Score::endCmd(bool rollback)
{
if (!undoStack()->active()) {
qDebug("Score::endCmd(): no cmd active");
LOGW() << "no command active";
update();
return;
}

if (readOnly() || MScore::_error != MsError::MS_NO_ERROR) {
rollback = true;
}
Expand All @@ -290,16 +292,16 @@ void Score::endCmd(const bool isCmdFromInspector, bool rollback)

update(false);

if (MScore::debugMode) {
qDebug("===endCmd() %d", undoStack()->current()->childCount());
}
const bool noUndo = undoStack()->current()->empty(); // nothing to undo?
LOGD() << "Undo stack current macro child count: " << undoStack()->current()->childCount();

const bool noUndo = undoStack()->current()->empty(); // nothing to undo?
undoStack()->endMacro(noUndo);

if (dirty()) {
masterScore()->setPlaylistDirty(); // TODO: flag individual operations
masterScore()->setPlaylistDirty(); // TODO: flag individual operations
masterScore()->setAutosaveDirty(true);
}

cmdState().reset();
}

Expand Down
4 changes: 2 additions & 2 deletions src/engraving/libmscore/score.h
Original file line number Diff line number Diff line change
Expand Up @@ -805,8 +805,8 @@ class Score : public QObject, public ScoreElement
bool checkTimeDelete(Segment*, Segment*);
void timeDelete(Measure*, Segment*, const Fraction&);

void startCmd(); // start undoable command
void endCmd(const bool isCmdFromInspector = false, bool rollback = false); // end undoable command
void startCmd(); // start undoable command
void endCmd(bool rollback = false); // end undoable command
void update() { update(true); }
void undoRedo(bool undo, EditData*);

Expand Down
2 changes: 1 addition & 1 deletion src/notation/internal/notationundostack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ void NotationUndoStack::rollbackChanges()
return;
}

score()->endCmd(false, true);
score()->endCmd(true);
masterScore()->setSaved(isStackClean());

notifyAboutStateChanged();
Expand Down

0 comments on commit 00c603c

Please sign in to comment.