AutomationEditor: thread-safe handling of AutomationPattern pointer

It was not possible to call any of the functions of AutomationEditor
from threads other than the main GUI thread as the m_pattern pointer
was not protected by a mutex. It is however desired to be able to call
for example AutomationEditor::setCurrentPattern(...) from different
threads (mainly required when deleting AutomationPatterns in other
threads). Thus made this method and all accesses to the m_pattern
pointer thread-safe.
(cherry picked from commit afba8a7ad4)
This commit is contained in:
Tobias Doerffel
2010-05-21 12:52:57 +02:00
parent 566a3334aa
commit aa992e8e1b
2 changed files with 78 additions and 46 deletions

View File

@@ -23,10 +23,10 @@
*
*/
#ifndef _AUTOMATION_EDITOR_H
#define _AUTOMATION_EDITOR_H
#include <QtCore/QMutex>
#include <QtGui/QWidget>
#include "lmms_basics.h"
@@ -75,6 +75,7 @@ public:
public slots:
void update();
void updateAfterPatternChange();
protected:
@@ -187,6 +188,7 @@ private:
ComboBoxModel m_zoomingYModel;
ComboBoxModel m_quantizeModel;
QMutex m_patternMutex;
automationPattern * m_pattern;
float m_minLevel;
float m_maxLevel;
@@ -239,6 +241,7 @@ private:
signals:
void currentPatternChanged();
void positionChanged( const midiTime & );
} ;