changeset 717:d2e8e9788cd4

More debug output, and fix crash after failed external-program alignment
author Chris Cannam
date Tue, 29 Oct 2019 15:59:42 +0000
parents 604393795ee5
children 464fed3096f5
files framework/Align.cpp
diffstat 1 files changed, 13 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/framework/Align.cpp	Tue Oct 29 12:47:44 2019 +0000
+++ b/framework/Align.cpp	Tue Oct 29 15:59:42 2019 +0000
@@ -525,6 +525,8 @@
     other->setAlignment(alignmentModelId);
 
     QProcess *process = new QProcess;
+    process->setProcessChannelMode(QProcess::ForwardedErrorChannel);
+
     QStringList args;
     args << refPath << otherPath;
     
@@ -532,6 +534,14 @@
             this, SLOT(alignmentProgramFinished(int, QProcess::ExitStatus)));
 
     m_pendingProcesses[process] = alignmentModelId;
+
+    SVCERR << "Align::alignModelViaProgram: Starting program \""
+           << program << "\" with args: ";
+    for (auto a: args) {
+        SVCERR << "\"" << a << "\" ";
+    }
+    SVCERR << endl;
+
     process->start(program, args);
 
     bool success = process->waitForStarted();
@@ -539,14 +549,15 @@
     if (!success) {
         SVCERR << "ERROR: Align::alignModelViaProgram: Program did not start"
                << endl;
-        error = "Alignment program could not be started";
+        error = "Alignment program \"" + program + "\" could not be executed";
         m_pendingProcesses.erase(process);
         other->setAlignment({});
         ModelById::release(alignmentModelId);
         delete process;
+    } else {
+        doc->addNonDerivedModel(alignmentModelId);
     }
 
-    doc->addNonDerivedModel(alignmentModelId);
     return success;
 }