# HG changeset patch # User Chris Cannam # Date 1588170433 -3600 # Node ID 5b6655449ba6d09df883ae50d5259e84d8346c64 # Parent e7c77c366360c821943577d63902e0355df92617 Refuse to nest OSC invocations diff -r e7c77c366360 -r 5b6655449ba6 framework/MainWindowBase.cpp --- a/framework/MainWindowBase.cpp Wed Apr 22 17:10:52 2020 +0100 +++ b/framework/MainWindowBase.cpp Wed Apr 29 15:27:13 2020 +0100 @@ -160,6 +160,7 @@ m_recentTransforms("RecentTransforms", 20), m_documentModified(false), m_openingAudioFile(false), + m_handlingOSC(false), m_labeller(nullptr), m_lastPlayStatusSec(0), m_initialDarkBackground(false), @@ -1565,10 +1566,10 @@ } } + m_openingAudioFile = true; + source.waitForData(); - m_openingAudioFile = true; - sv_samplerate_t rate = 0; SVDEBUG << "Checking whether to preserve incoming audio file's sample rate" @@ -4279,12 +4280,22 @@ { if (!m_oscQueue || m_oscQueue->isEmpty()) return; + if (m_handlingOSC) { + SVDEBUG << "MainWindowBase::pollOSC: " + << "not making nested invocations, waiting" + << endl; + return; + } + + m_handlingOSC = true; + while (!m_oscQueue->isEmpty()) { if (m_openingAudioFile) { SVDEBUG << "MainWindowBase::pollOSC: " << "waiting for audio to finish loading" << endl; + m_handlingOSC = false; return; } @@ -4292,6 +4303,7 @@ SVDEBUG << "MainWindowBase::pollOSC: " << "waiting for running transforms to complete" << endl; + m_handlingOSC = false; return; } @@ -4304,6 +4316,7 @@ if (message.getTarget() != 0) { SVCERR << "MainWindowBase::pollOSC: ignoring message with target " << message.getTarget() << " (we are target 0)" << endl; + m_handlingOSC = false; continue; } @@ -4314,10 +4327,12 @@ QApplication::processEvents(QEventLoop::ExcludeUserInputEvents | QEventLoop::ExcludeSocketNotifiers); - - connect(m_oscQueue, SIGNAL(messagesAvailable()), - this, SLOT(pollOSC())); } + + m_handlingOSC = false; + + connect(m_oscQueue, SIGNAL(messagesAvailable()), + this, SLOT(pollOSC())); } void diff -r e7c77c366360 -r 5b6655449ba6 framework/MainWindowBase.h --- a/framework/MainWindowBase.h Wed Apr 22 17:10:52 2020 +0100 +++ b/framework/MainWindowBase.h Wed Apr 29 15:27:13 2020 +0100 @@ -449,6 +449,7 @@ bool m_documentModified; bool m_openingAudioFile; + bool m_handlingOSC; Labeller *m_labeller;