Skip to content

Commit

Permalink
fix #38676
Browse files Browse the repository at this point in the history
  • Loading branch information
wschweer committed Nov 10, 2014
1 parent aab56a4 commit b24f784
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
5 changes: 4 additions & 1 deletion libmscore/duration.cpp
Expand Up @@ -46,8 +46,11 @@ DurationElement::DurationElement(const DurationElement& e)

DurationElement::~DurationElement()
{
if (tuplet() && tuplet()->elements().front() == this)
qDebug("~DurationElement: tuplet %p", tuplet());
if (tuplet() && !tuplet()->elements().isEmpty() && tuplet()->elements().front() == this) {
qDebug(" delete tuplet");
delete tuplet();
}
}

//---------------------------------------------------------
Expand Down
10 changes: 4 additions & 6 deletions libmscore/undo.cpp
Expand Up @@ -192,11 +192,9 @@ UndoStack::UndoStack()

UndoStack::~UndoStack()
{
int idx;
for (auto c : list) {
printf("cleanup %d <= %d\n", idx, curIdx);
int idx = 0;
for (auto c : list)
c->cleanup(idx++ < curIdx);
}
qDeleteAll(list);
}

Expand Down Expand Up @@ -1422,7 +1420,7 @@ AddElement::AddElement(Element* e)
void AddElement::cleanup(bool undo)
{
if (!undo) {
qDebug("delete %d %s", undo, element->name());
qDebug("AddElement::cleanup: delete %d %s", undo, element->name());
delete element;
element = 0;
}
Expand Down Expand Up @@ -1600,7 +1598,7 @@ RemoveElement::RemoveElement(Element* e)
void RemoveElement::cleanup(bool undo)
{
if (undo) {
qDebug("delete %d %s", undo, element->name());
qDebug("RemoveElement::cleanup: delete %d %s", undo, element->name());
delete element;
element = 0;
}
Expand Down

0 comments on commit b24f784

Please sign in to comment.