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.
This commit is contained in:
Tobias Doerffel
2010-05-21 12:52:57 +02:00
parent ace2266529
commit afba8a7ad4
2 changed files with 78 additions and 46 deletions

View File

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