From 9827d4a753579c19fa7616eb3da42e5c18c5213b Mon Sep 17 00:00:00 2001 From: Leland Lucius Date: Wed, 15 Apr 2020 10:10:00 -0500 Subject: [PATCH] Bug 2360 - Scripting: "Message:" command may crash when using Nyquist with Python --- src/commands/ScriptCommandRelay.cpp | 6 ++++++ src/effects/nyquist/Nyquist.cpp | 10 +++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/commands/ScriptCommandRelay.cpp b/src/commands/ScriptCommandRelay.cpp index aace234e9..23255e595 100644 --- a/src/commands/ScriptCommandRelay.cpp +++ b/src/commands/ScriptCommandRelay.cpp @@ -128,6 +128,11 @@ int ExecCommand2(wxString *pIn, wxString *pOut) // Wait until all responses from the command have been received. // The last response is signalled by an empty line. + // + // LLL: Allow ExecCommand() to process the responses, otherwise + // it will hang waiting for more responses that will not be + // forthcoming. + #if 0 wxString msg = ScriptCommandRelay::ReceiveResponse().GetMessage(); while (msg != wxT("\n")) { @@ -135,6 +140,7 @@ int ExecCommand2(wxString *pIn, wxString *pOut) *pOut += msg + wxT("\n"); msg = ScriptCommandRelay::ReceiveResponse().GetMessage(); } + #endif return 0; } diff --git a/src/effects/nyquist/Nyquist.cpp b/src/effects/nyquist/Nyquist.cpp index 630f3e6f1..6754fad31 100644 --- a/src/effects/nyquist/Nyquist.cpp +++ b/src/effects/nyquist/Nyquist.cpp @@ -1448,10 +1448,14 @@ bool NyquistEffect::ProcessOne() // if necessary, by gettext or ngettext defined below, before it is // communicated back to C++ auto msg = Verbatim( NyquistToWxString(nyx_get_string()) ); - if (!msg.empty()) // Empty string may be used as a No-Op return value. - Effect::MessageBox( msg ); - else + if (!msg.empty()) { // Empty string may be used as a No-Op return value. + if (!mExternal) { + Effect::MessageBox( msg ); + } + } + else { return true; + } // True if not process type. // If not returning audio from process effect,