Problem with TGFileDialog

I am developping a stand alone application using root. My application is based on a GUI built using a custom TGMainFrame.

I select and open the data file using TGFileDialog, and then I draw different histograms. Each time I open a new file, I close the previous one. Everything works fine and I can open two data files without any problems. When I try to open a third one, the dialog box freeze and the program do not answer to any action.

I enclose the code calling the TGFileDialog variable.

static const char *FileType[] = {"Data file", "*.geom", 0, 0 }; TGFileInfo *FileInfo = new TGFileInfo(); FileInfo -> fFileTypes = FileType; FileInfo -> fIniDir = StrDup("/benjamin/mre_data/"); new TGFileDialog(gClient -> GetRoot(), this, kFDOpen,FileInfo);

Hi,

Please try the following:

static const char *FileType[] = {"Data file", "*.geom", 0, 0 }; static TString dir("/benjamin/mre_data/"); TGFileInfo fi; fi.fFileTypes = FileType; fi.fIniDir = StrDup(dir); new TGFileDialog(gClient->GetRoot(), this, kFDOpen, &fi);

Cheers, Ilka

I used your code instead of mine. But it didn’t change anything.

Hi,

can you send an example that will help me to reproduce the problem (as small as possible running macro)?

Thank you, Ilka

I am really sorry. My problem was not linked to the use of the class TGFileDialog. It was linked to my memory management. I forgot to delete pointers which led me to this strange behavior.

Thanks for your help…

Hi,
You are welcome and please do not hesitate to share your problems (if any).
Cheers, Ilka