comparison framework/Align.cpp @ 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
comparison
equal deleted inserted replaced
716:604393795ee5 717:d2e8e9788cd4
523 std::make_shared<AlignmentModel>(referenceId, otherId, ModelId()); 523 std::make_shared<AlignmentModel>(referenceId, otherId, ModelId());
524 auto alignmentModelId = ModelById::add(alignmentModel); 524 auto alignmentModelId = ModelById::add(alignmentModel);
525 other->setAlignment(alignmentModelId); 525 other->setAlignment(alignmentModelId);
526 526
527 QProcess *process = new QProcess; 527 QProcess *process = new QProcess;
528 process->setProcessChannelMode(QProcess::ForwardedErrorChannel);
529
528 QStringList args; 530 QStringList args;
529 args << refPath << otherPath; 531 args << refPath << otherPath;
530 532
531 connect(process, SIGNAL(finished(int, QProcess::ExitStatus)), 533 connect(process, SIGNAL(finished(int, QProcess::ExitStatus)),
532 this, SLOT(alignmentProgramFinished(int, QProcess::ExitStatus))); 534 this, SLOT(alignmentProgramFinished(int, QProcess::ExitStatus)));
533 535
534 m_pendingProcesses[process] = alignmentModelId; 536 m_pendingProcesses[process] = alignmentModelId;
537
538 SVCERR << "Align::alignModelViaProgram: Starting program \""
539 << program << "\" with args: ";
540 for (auto a: args) {
541 SVCERR << "\"" << a << "\" ";
542 }
543 SVCERR << endl;
544
535 process->start(program, args); 545 process->start(program, args);
536 546
537 bool success = process->waitForStarted(); 547 bool success = process->waitForStarted();
538 548
539 if (!success) { 549 if (!success) {
540 SVCERR << "ERROR: Align::alignModelViaProgram: Program did not start" 550 SVCERR << "ERROR: Align::alignModelViaProgram: Program did not start"
541 << endl; 551 << endl;
542 error = "Alignment program could not be started"; 552 error = "Alignment program \"" + program + "\" could not be executed";
543 m_pendingProcesses.erase(process); 553 m_pendingProcesses.erase(process);
544 other->setAlignment({}); 554 other->setAlignment({});
545 ModelById::release(alignmentModelId); 555 ModelById::release(alignmentModelId);
546 delete process; 556 delete process;
547 } 557 } else {
548 558 doc->addNonDerivedModel(alignmentModelId);
549 doc->addNonDerivedModel(alignmentModelId); 559 }
560
550 return success; 561 return success;
551 } 562 }
552 563
553 void 564 void
554 Align::alignmentProgramFinished(int exitCode, QProcess::ExitStatus status) 565 Align::alignmentProgramFinished(int exitCode, QProcess::ExitStatus status)