Mercurial > hg > svapp
comparison framework/MainWindowBase.cpp @ 516:b926f08909b8 alignment-simple
Fix crashes in play() and stop() if no record target / play source present
author | Chris Cannam |
---|---|
date | Thu, 03 Mar 2016 09:12:28 +0000 |
parents | 51befd6165a3 |
children | 3ab6a5f7aca8 |
comparison
equal
deleted
inserted
replaced
515:51befd6165a3 | 516:b926f08909b8 |
---|---|
2704 } | 2704 } |
2705 | 2705 |
2706 void | 2706 void |
2707 MainWindowBase::play() | 2707 MainWindowBase::play() |
2708 { | 2708 { |
2709 if (m_recordTarget->isRecording() || m_playSource->isPlaying()) { | 2709 if ((m_recordTarget && m_recordTarget->isRecording()) || |
2710 (m_playSource && m_playSource->isPlaying())) { | |
2710 stop(); | 2711 stop(); |
2711 QAction *action = qobject_cast<QAction *>(sender()); | 2712 QAction *action = qobject_cast<QAction *>(sender()); |
2712 if (action) action->setChecked(false); | 2713 if (action) action->setChecked(false); |
2713 } else { | 2714 } else { |
2714 if (m_audioIO) m_audioIO->resume(); | 2715 if (m_audioIO) m_audioIO->resume(); |
3083 } | 3084 } |
3084 | 3085 |
3085 void | 3086 void |
3086 MainWindowBase::stop() | 3087 MainWindowBase::stop() |
3087 { | 3088 { |
3088 if (m_recordTarget->isRecording()) { | 3089 if (m_recordTarget && |
3090 m_recordTarget->isRecording()) { | |
3089 m_recordTarget->stopRecording(); | 3091 m_recordTarget->stopRecording(); |
3090 } | 3092 } |
3091 | 3093 |
3094 if (!m_playSource) return; | |
3095 | |
3092 m_playSource->stop(); | 3096 m_playSource->stop(); |
3093 | 3097 |
3094 if (m_audioIO) m_audioIO->suspend(); | 3098 if (m_audioIO) m_audioIO->suspend(); |
3095 else if (m_playTarget) m_playTarget->suspend(); | 3099 else if (m_playTarget) m_playTarget->suspend(); |
3096 | 3100 |