Commit c17fa277 authored by Erik von Reis's avatar Erik von Reis
Browse files

work around ROOT error that crashes foton

parent 33e2505e
Pipeline #230315 failed with stages
in 3 minutes and 2 seconds
......@@ -859,6 +859,7 @@ TLGFilterWizWindow::FileErrorIndication(Bool_t error)
//-------- Command text-box
fCommand = new TLGTextEdit (fG[3], 10, 10, kCommandId);
fCommand->Clear();
fCommand->Associate (this);
fG[3]->AddFrame (fCommand, 0);
......@@ -1046,6 +1047,7 @@ TLGFilterWizWindow::FileErrorIndication(Bool_t error)
{
if (strcmp (name, ".") && strcmp(name, ".."))
{
printf("Checking file %s... ", name);
// found a file: open it and check magic token
string fullname = string (dir) + "/" + name;
ifstream inp (fullname.c_str());
......@@ -1053,8 +1055,10 @@ TLGFilterWizWindow::FileErrorIndication(Bool_t error)
inp.read (line, lMagic);
if (inp && (strncmp (line, kMagic, lMagic) == 0))
{
printf("Added\n");
nlist.push_back (name);
}
printf("Ignored\n");
}
}
gSystem->FreeDirectory(dirp);
......@@ -1916,6 +1920,7 @@ TLGFilterWizWindow::FileErrorIndication(Bool_t error)
}
if ((fCurSections.size() != 1) && (fCurDesignActive || force))
{
fCommand->Clear();
// Set the state of the GUI widgets for multiple selected sections.
fCommand->LoadBuffer (" ");
fCommand->SetState (kFALSE);
......
......@@ -81,8 +81,32 @@ namespace ligogui {
// newline characters), removes the funky tab padding characters
// and reformats it into a STL string.
//
TString txt = GetText()->AsString();
int N = txt.Length();
// work-around GetText()->AsString(), which is buggy.
auto text_block = GetText();
// AsString() is broken. The only public access is
// TGText::GetChar()
TGLongPosition pos(0,0);
char c;
std::string txt = "";
while((c = text_block->GetChar(pos)) >= 0)
{
do {
if(c != cmt) {
txt += c;
}
pos.fX += 1;
} while((c = text_block->GetChar(pos)) >= 0 && c != cmt);
pos.fX = 0;
pos.fY += 1;
txt += '\n';
}
int N = txt.length();
std::string cmd;
cmd.reserve(N);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment