Problem with TGTextView

Hello,
i have made a gui in which there is a TGTextView. To write information in this widget, i use the method AddLine(const char* buff).
This works very well until i use this method 169 times in the same class.
I suddenlty quit kde.I tested it with only 168 call to AddLine method and there is no problem.
With 170 calll, it also works fine.
It seems to be that the problem is a number of lines in TGTextView. I saw TGTextView class and i haven’t found any limitation.
Can anybody help me?
NB: i use root 5.10 under SLC3 (scientific linux cern version 3)
Fabien

Could you post the shortest possible running script reproducing this problem?

Rene

Hello,
i had this problem with compilled code.
I send you three class and the makefile to reproduce the problem.
So, you 'll have to make ./G4MacroMenu and a window appears–>press button Source and another window appears. Put some value in the the TGTextEntry and press Ok.
It will execute 169 call to the method AddLine() and it crashes.
In the main window, if you press run button, a window appears. After entering value in TGTextEntry, if you press OK, nothing is done because there is only one call to AddLine in this class.
Fabien
main.cxx (258 Bytes)

You sent only a short main program. G4MacroMenu.hh is missing.
Could you send the shortest possible RUNNING script reproducing the problem?

Rene

Hello,
i send you an archive with 8 files–>G4EnergieMacro(.cc+.hh), G4TubeMat(.hh+.cc–>this class execute 169 call to AddLine method), G4MacroMenu(.hh+.cc–>main window), main.cxx,Makefile,Makefile.arch.
Fabien

Sorry, i have forgotten to attach files
Fabien

Sorry i have some trouble with attachment
gui.tar (130 KB)

Hi Fabien,

I will investigate your example. You might help me by providing a scenario to follow with your gui.

Thank you, Ilka

Ok,
first you’ll have to compile it–> make.
Then the main window appears–>press Source button and another one woindow appears.
Enter value in the TGTextEntry and press Ok–>it will execute 169 call to AddLine method so it crash.
In the main window, if you press Run button a window appears to entre energy–>if you press Ok a single call to AddLine method is done so the process don’t crash.
Fabien

Sorry,
I have forgotten to tell you to lauch the executable : you will do ./G4MacroMenu and the main window appears.
Fabien

Hi Fabien,

Thank you for provided information - I will test your GUI on Tuesday once I am back at work (it is long Easter weekend in Switzerland and today is a holiday).

Cheers, Ilka

Hi Fabien,

I see no problem running your code - the attached Source.txt file shows much more then 169 lines written there. It was difficult to select them because of the frame size, but I sucseeded finally.

BTW the window that appears after the Source button is clicked, has many input fields. You might want to provide additional info in which text entry what string exactly I should write.

Cheers, Ilka
Source.txt (41.8 KB)

Hello Ilka,
I am very surprised that the code runs very well–>i check it once again and when i clicked SourceButton, i quit kde session (i have just entered text in field Nom du materiau). :exclamation:
I use SLC3 (ScientificLinuxCern 3) and Root 5.10.00 and you?
I don’t understand why this code doesn’t crash when you run it.
In file G4TubeMat.cc, if i comment one line tmmacroMenu->GetSourceTextView()->AddLine(…), there’s no problem. What a strange behaviour! It means maybe that there is an exception somewhere on the number of line of TGTextView but it don’t find anything about it !!!
I don’t understand why when the code crashes i automatically quit kde instead of having an error message like segmentation violation. Maybe the code try to write on systeme memory?
Have you any idea ?
Thanks to have test it (it means that the problem is on the pc i use :frowning: )
Fabien

Hi Fabien,

I have tested your code on SLC3 and the latest cvs head (there will be a new release later today). I can only confirm that writing a name in ‘Nom du materiau’ creates 169 lines and any new name adds another 169 lines with no problem. The only limit I see is related to kMaxLen = 8000 in TGText.cxx, but as I wrote I have no problem testing your example.

Best regards, Ilka

Could you tell me if you use kde or gnome :
if my code runs under kde (KDE3.1), it crashes but if i work with Gnome, there’s no problem.
I can’t explain why there is a problem with kde, but i can “solve” the problem by working with gnome.
Fabien

Hi,

I am using KDE:
KDE version 3.1.3-6.10 Red Hat
Linux 2.4.21-37.EL.cern (SLC3)

Cheers, Ilka