diff options
author | Uwe Klotz <uklotz@mixxx.org> | 2020-06-01 12:22:54 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-01 12:22:54 +0200 |
commit | 30c7b4bae1a7b91dd353d27c06431c7f00438bd0 (patch) | |
tree | 3a222669ba69d447edb8398c73baeaf5c656dbcf /src/waveform | |
parent | 93de54eabead58a345af7379ea2e4bf0e39b196f (diff) | |
parent | 9d1721d58a6f55d15a26550dbd4e20b75c92c35f (diff) |
Merge pull request #2792 from daschuer/valgrind
Valgrind fixes
Diffstat (limited to 'src/waveform')
-rw-r--r-- | src/waveform/waveformwidgetfactory.cpp | 26 | ||||
-rw-r--r-- | src/waveform/waveformwidgetfactory.h | 4 |
2 files changed, 20 insertions, 10 deletions
diff --git a/src/waveform/waveformwidgetfactory.cpp b/src/waveform/waveformwidgetfactory.cpp index 0c0c3037c8..8f26efc76a 100644 --- a/src/waveform/waveformwidgetfactory.cpp +++ b/src/waveform/waveformwidgetfactory.cpp @@ -99,6 +99,7 @@ WaveformWidgetFactory::WaveformWidgetFactory() // Concretely, we want to set a non-GL waveform when loading the skin so that the window // loads correctly. : m_type(WaveformWidgetType::EmptyWaveform), + m_configType(WaveformWidgetType::EmptyWaveform), m_config(0), m_skipRender(false), m_frameRate(30), @@ -316,8 +317,8 @@ bool WaveformWidgetFactory::setConfig(UserSettingsPointer config) { m_config->getValueString(ConfigKey("[Waveform]","WaveformType")).toInt(&ok)); // Store the widget type on m_configType for later initialization. // We will initialize the objects later because of a problem with GL on QT 5.14.2 on Windows - if (!ok || !setWidgetType(type, m_configType)) { - setWidgetType(autoChooseWidgetType(), m_configType); + if (!ok || !setWidgetType(type, &m_configType)) { + setWidgetType(autoChooseWidgetType(), &m_configType); } for (int i = 0; i < FilterCount; i++) { @@ -449,28 +450,35 @@ int WaveformWidgetFactory::getVSyncType() { } bool WaveformWidgetFactory::setWidgetType(WaveformWidgetType::Type type) { - return setWidgetType(type, m_type); + return setWidgetType(type, &m_type); } -bool WaveformWidgetFactory::setWidgetType(WaveformWidgetType::Type type, WaveformWidgetType::Type& currentType) { - if (type == currentType) +bool WaveformWidgetFactory::setWidgetType( + WaveformWidgetType::Type type, + WaveformWidgetType::Type* pCurrentType) { + if (type == *pCurrentType) { return true; + } // check if type is acceptable int index = findHandleIndexFromType(type); if (index > -1) { // type is acceptable - currentType = type; + *pCurrentType = type; if (m_config) { - m_config->setValue(ConfigKey("[Waveform]", "WaveformType"), static_cast<int>(currentType)); + m_config->setValue( + ConfigKey("[Waveform]", "WaveformType"), + static_cast<int>(*pCurrentType)); } return true; } // fallback - currentType = WaveformWidgetType::EmptyWaveform; + *pCurrentType = WaveformWidgetType::EmptyWaveform; if (m_config) { - m_config->setValue(ConfigKey("[Waveform]", "WaveformType"), static_cast<int>(currentType)); + m_config->setValue( + ConfigKey("[Waveform]", "WaveformType"), + static_cast<int>(*pCurrentType)); } return false; } diff --git a/src/waveform/waveformwidgetfactory.h b/src/waveform/waveformwidgetfactory.h index 83e26c579f..7b09932fde 100644 --- a/src/waveform/waveformwidgetfactory.h +++ b/src/waveform/waveformwidgetfactory.h @@ -96,7 +96,9 @@ class WaveformWidgetFactory : public QObject, public Singleton<WaveformWidgetFac WaveformWidgetType::Type getType() const { return m_type;} protected: - bool setWidgetType(WaveformWidgetType::Type type, WaveformWidgetType::Type& currentType); + bool setWidgetType( + WaveformWidgetType::Type type, + WaveformWidgetType::Type* pCurrentType); public: void setDefaultZoom(double zoom); |