musrFT: fix the Fourier canvas on macOS and starting it from musredit.

- PFourierCanvas.h only forward declares PFourier. Including PFourier.h put
  fftw3.h into the dictionary payload, and cling (ROOT 6.40, macOS SDK 26+)
  fails on its '#include <stddef.h>', which lost the interpreter info of
  PFourierCanvas and with it all its signal/slot connections.
- musredit: run musrFT in the directory of the msr-file and write musrFT.log
  there. Started from the Finder/Dock the working directory is '/', the log
  cannot be written and QProcess refused to start musrFT. Merge stderr into
  the log, show the full command and the reason if starting fails.
This commit is contained in:
suter_a committed 2026-10-13 18:38:08 +02:00
1 parent 06e76aa801
commit 387cab4045
4 files changed
+31 -9

No files matched your search

+1
View File
@@ -37,6 +37,7 @@
#include <TMath.h>
#include <TGFileDialog.h>
#include "PFourier.h"
#include "PFourierCanvas.h"
#include "icons/musrFT_icon.xpm"
+6 -1
View File
@@ -47,7 +47,12 @@
#include <TLatex.h>
#include "PMusr.h"
#include "PFourier.h"
// Only a forward declaration: PFourier.h pulls in fftw3.h, which would end up in
// the dictionary payload parsed by cling at run time. On macOS (SDK 26+) cling
// fails on its '#include <stddef.h>', which loses the interpreter info of
// PFourierCanvas and with it all its signal/slot connections.
class PFourier;
// Canvas menu id's
#define P_MENU_ID_FOURIER 10001
+12 -4
View File
@@ -2807,8 +2807,14 @@ void PTextEdit::musrFT()
if (dlg->exec() == QDialog::Accepted) {
fMusrFTPrevCmd = dlg->getMusrFTOptions();
QProcess *proc = new QProcess(this);
proc->setStandardOutputFile("musrFT.log");
proc->setStandardErrorFile("musrFT.log");
// run musrFT in the directory of the msr-file. musredit started from the Finder/Dock
// has '/' as working directory, where the log-file cannot be written, and QProcess then
// refuses to start musrFT at all.
QFileInfo fi(*fFilenames.find(currentEditor()));
QString workDir = fi.exists() ? fi.absolutePath() : QDir::homePath();
proc->setWorkingDirectory(workDir);
proc->setProcessChannelMode(QProcess::MergedChannels);
proc->setStandardOutputFile(workDir + "/musrFT.log");
QString cmd = fAdmin->getExecPath() + "/musrFT";
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
#if defined(Q_OS_DARWIN)
@@ -2820,12 +2826,14 @@ void PTextEdit::musrFT()
proc->start(cmd, fMusrFTPrevCmd);
if (!proc->waitForStarted()) {
// error handling
QString msg(tr("Could not execute the output command: ")+cmd[0]);
QString msg(tr("Could not execute the output command: ")+cmd+"\n"+proc->errorString());
QMessageBox::critical( nullptr,
tr("Fatal error"),
msg,
tr("Quit") );
return;
proc->deleteLater();
} else {
connect(proc, SIGNAL(finished(int,QProcess::ExitStatus)), proc, SLOT(deleteLater()));
}
}
+12 -4
View File
@@ -2910,8 +2910,14 @@ void PTextEdit::musrFT()
if (dlg->exec() == QDialog::Accepted) {
fMusrFTPrevCmd = dlg->getMusrFTOptions();
QProcess *proc = new QProcess(this);
proc->setStandardOutputFile("musrFT.log");
proc->setStandardErrorFile("musrFT.log");
// run musrFT in the directory of the msr-file. musredit started from the Finder/Dock
// has '/' as working directory, where the log-file cannot be written, and QProcess then
// refuses to start musrFT at all.
QFileInfo fi(*fFilenames.find(currentEditor()));
QString workDir = fi.exists() ? fi.absolutePath() : QDir::homePath();
proc->setWorkingDirectory(workDir);
proc->setProcessChannelMode(QProcess::MergedChannels);
proc->setStandardOutputFile(workDir + "/musrFT.log");
QString cmd = fAdmin->getExecPath() + "/musrFT";
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
#if defined(Q_OS_DARWIN)
@@ -2923,9 +2929,11 @@ void PTextEdit::musrFT()
proc->start(cmd, fMusrFTPrevCmd);
if (!proc->waitForStarted()) {
// error handling
QString msg(tr("Could not execute the output command: ")+cmd[0]);
QString msg(tr("Could not execute the output command: ")+cmd+"\n"+proc->errorString());
QMessageBox::critical( nullptr, tr("FATAL ERROR"), msg, QMessageBox::Close );
return;
proc->deleteLater();
} else {
connect(proc, SIGNAL(finished(int,QProcess::ExitStatus)), proc, SLOT(deleteLater()));
}
}