This simple loop hangs forever. Note that ntuples[] has two valid
pointers (TNtuples with 25 and 15 entries), and nNtuples=2; they are
both class variables. This is a small part of a large macro entered on
the root command-line. This code is preparing to fill a TGraph with data
from multiple TNtuples, and needs to know how many entries to allocate.
// count total entries int ntotal=0; for(int j=0; j<nNtuples; ++j) { TNtuple *ntuple = ntuples[j]; ntotal += ntuple->GetEntries(); } So I instrumented it: // count total entries int ntotal=0;
//int k=0;
for(int j=0; j<nNtuples; ++j) {
TNtuple *ntuple = ntuples[j]; printf("scan total entries B: j=%d\n",j); fflush(stdout); ntotal += ntuple->GetEntries(); printf("scan total entries C: j=%d\n",j); fflush(stdout); }
The output runs forever and begins:
scan total entries A: j=0 scan total entries B: j=0 scan total entries C: j=0 scan total entries A: j=1 scan total entries B: j=1 scan total entries C: j=0 scan total entries A: j=1 scan total entries B: j=1 scan total entries C: j=0 scan total entries A: j=1 scan total entries B: j=1 scan total entries C: j=0
Clearly something is clobbering j. If I give it 3 or more TNtuples in ntuples[] and nNtuples, j still gets set to 0 while processing j=1.
The weird part which makes me think this is a CINT problem: If I uncomment the two lines referencing k it executes properly (i.e. 2 times through the loop).
This routine was called in response to the signal from a carriage-return entered into a TGTextEntry. Results are identical if it is called in response to moving either end of a TGDoubleHSlider. No surprise -- I built my own widget containing a TGDoubleHSlider and two TGTextEntry-s, and it generates a Changed() signal that was connected to this routine. As this smells like a signal problem, I am currently re-structuring my code to avoid the cascaded signals....
This is root 5.14 running on Mac OS X (Intel). On Linux it also hangs in response to that <CR>, but I did not track it down.
Tom Roberts Received on Mon Aug 27 2007 - 22:09:19 CEST
This archive was generated by hypermail 2.2.0 : Mon Aug 27 2007 - 23:50:02 CEST