Fix detuning crash after deleting the note being edited (#4324)

This commit is contained in:
Hyunjin Song authored and GitHub committed 2018-04-30 14:54:34 +09:00
1 parent 84d3c935de
commit 08573fc96d
1 file changed
+4 -3
+4 -3
View File
@@ -31,6 +31,7 @@
#include <QLayout>
#include <QMdiArea>
#include <QPainter>
#include <QPointer>
#include <QScrollBar>
#include <QStyleOption>
#include <QSignalMapper>
@@ -1334,8 +1335,8 @@ void PianoRoll::mousePressEvent(QMouseEvent * me )
if( m_editMode == ModeEditDetuning && noteUnderMouse() )
{
static AutomationPattern* detuningPattern = nullptr;
if (detuningPattern != nullptr)
static QPointer<AutomationPattern> detuningPattern = nullptr;
if (detuningPattern.data() != nullptr)
{
detuningPattern->disconnect(this);
}
@@ -1345,7 +1346,7 @@ void PianoRoll::mousePressEvent(QMouseEvent * me )
n->createDetuning();
}
detuningPattern = n->detuning()->automationPattern();
connect(detuningPattern, SIGNAL(dataChanged()), this, SLOT(update()));
connect(detuningPattern.data(), SIGNAL(dataChanged()), this, SLOT(update()));
gui->automationEditor()->open(detuningPattern);
return;
}