Merged in segfault (pull request #15)

fix segfault

Approved-by: Andreas Suter
This commit is contained in:
Ryan M. L. McFadden 2024-06-18 06:18:14 +00:00 committed by Andreas Suter
commit 1845b5c176
2 changed files with 15 additions and 15 deletions

View File

@ -1437,19 +1437,18 @@ Int_t main(Int_t argc, Char_t *argv[])
musrFT_dumpData(startupParam.dumpFln, fourier, startupParam.fourierRange[0], startupParam.fourierRange[1]);
} else { // do Canvas
// if Fourier graphical export is whished, switch to batch mode
// if Fourier graphical export is wished, switch to batch mode
Bool_t batch = false;
int cc=0;
char **arg;
// create list of essential arguments to pass to the ROOT application
std::vector<char*> args;
args.push_back(argv[0]); // program name
if (startupParam.graphicFormat.Length() != 0) {
batch = true;
arg[cc] = (Char_t*)malloc(16*sizeof(Char_t));
strcpy(arg[cc], "-b");
cc++;
args.push_back((char*)"-b"); // batch mode flag
}
int cc = args.size();
// plot the Fourier transform
TApplication app("App", &cc, arg);
TApplication app("App", &cc, args.data());
if (startupHandler) {
fourierCanvas = std::unique_ptr<PFourierCanvas>(new PFourierCanvas(fourier, dataSetTag, startupParam.title.Data(),

View File

@ -37,6 +37,7 @@
#include <iostream>
#include <memory>
#include <vector>
#include <TApplication.h>
#include <TSAXParser.h>
@ -301,15 +302,15 @@ int main(int argc, char *argv[])
}
if (result == PMUSR_SUCCESS) {
// generate Root application needed for PMusrCanvas
int cc=0;
char **arg;
// create the ROOT application needed for PMusrCanvas
// and pass it only essential arguments
std::vector<char*> args;
args.push_back(argv[0]); // program name
if (graphicsOutput || asciiOutput) {
arg[cc] = (char*)malloc(16*sizeof(char));
strcpy(arg[cc], "-b");
cc++;
args.push_back((char*)"-b"); // batch mode flag
}
TApplication app("App", &cc, arg);
int cc = args.size();
TApplication app("App", &cc, args.data());
std::vector<PMusrCanvas*> canvasVector;
PMusrCanvas *musrCanvas;