Dear QtRoot Gurus (Valeri that is, right?),
I started developing a GUI based on QtRoot, which is now in a running state.
However I came across a very strange behaviour when building/running it on one of our office machines: After the TQtWidget Object initialisation I run into a seg fault, since the pointer to fCanvas (widget->GetCanvas()) is NULL. This also happens in the examples (e.g. HelloClick).
The machine where this fails is a Intel core2 quad with a 64bit Ubuntu 10.04. During the Init() method of TQtWidget the fCanvas gets properly built (of course) and the pointer is valid, but after that it gets corrupted somehow. The same code runs on 32bit systems and on my home computer, which is an AMD Phenom II quad also with 64bit Ubuntu 10.04.
The first guess was that maybe at some point the pointer is cast to a 32bit type, and that different memory allocation on the AMD and Intel system might lead to different behaviour. However, we haven’t verified that. I would be very interested in a fix, and I will keep you updated on new sympoms/findings.
[quote=“quantenknecht”]Dear QtRoot Gurus (Valeri that is, right?),
… The first guess was that maybe at some point the pointer is cast to a 32bit type, … [/quote]Hi Felix. Thank you very much for your report. I understood your point and will try to reproduce the issue. On the other hand, I would appreciate of you could produce the call stack at the time of crash. I would like to know your version of ROOT and the source of QtROOT ( You mentioned the HelloClick, I assume you used the BNL version). I would like to mention that ROOT (plain ROOT with no Qt) holds the “handler” of the GUI widget (X11/Win32/QT) as “long” data -member within TCanvas /TPad object. This is to say that yes some conversion Pointer <-> “long” is present. ROOT assumes that the “long” is always long enough to hold the pointer. Yes, It was tested. Please send me some extra information . This may help. Thank you.
[quote=“quantenknecht”]…After the TQtWidget Object initialisation I run into a seg fault, since the pointer to fCanvas (widget->GetCanvas()) is NULL. This also happens in the examples (e.g. HelloClick).
…[/quote]Are you saying that the value of the fCanvas data-member of TQtWidget class becomes eventually NULL?
Can you see it with the debugger ?
Can you “watch” with the debugger this data-member to catch the moment its value is about to change to see where that thing comes from? Thank you.
first of all: thanks for the fast reaction!
I am not in my office today, so it will be a little bit cumbersome to produce a nice stack trace for you. As soon as I manage, I will post it here.
I am using ROOT 5.26 (built from source) and QtRoot I downloaded as tar-ball from the BNL site.
[quote]Are you saying that the value of the fCanvas data-member of TQtWidget class becomes eventually NULL?
Can you see it with the debugger ?[/quote]
Yes, that is what I saw. The value of the pointer actually changed, but I am not sure where exactly. I will give you more details soon.
[quote=“quantenknecht”]… Yes, that is what I saw. The value of the pointer actually changed, but I am not sure where exactly. I will give you more details soon…[/quote]This is very strange observation. That pointer is supposed to be living unchanged by the end of TQtWidget object life. In the other words, it is not that pointer casted to integer back/force issue. What you see is a side effect of some incident happened elsewhere. Hope the debugger “watch” will clarify where the problem coming from. ( as usually make sure there is only one Qt/Root/QtRoot on your LD_LIBRARY_PATH )
I have been able to trace back the error (I think). As it turned out, it might have been a very (!) subtle bug due to a wrongly linked library. After recompilation of everything involved with more correct settings I cannot reproduce it anymore. It seems that everything is working now
Thanks for the fast reaction and help in anyway!