Hello all,
I am having some trouble with a qt app using ROOT to display multiple histograms at the same time.
No problem to draw the histograms or interact with them but as soon as the app loses the focus (clicking outside the app windows):
Fatal in <TFdSet::IsSet>: fd (1139206320) out of range [0..1023]
aborting
[<unknown binary>]
...
[<unknown binary>]
Abort trap: 6
Looks like fd is undefined.
After some digging I end up looking into $ROOTSYS/core/macosx/src/TMacOSXSystem.mm for the culprit:
void TMacOSXSystem::ProcessApplicationDefinedEvent(void *e)
{
...
NSEvent *event = (NSEvent *)e;
...
if (fReadmask->IsSet(event.data1)) {
fReadready->Set(event.data1);
descriptorFound = true;
}
...
}
NSEvent definition and ProcessApplicationDefinedEvent() call is done in WaitEvents() and I don’t have the impression that data1 is initialised:
void TMacOSXSystem::WaitEvents(Long_t nextto)
{
...
NSEvent *event = [NSApp nextEventMatchingMask : NSAnyEventMask
untilDate : untilDate inMode : NSDefaultRunLoopMode dequeue : YES];
if (event) {
if (event.type == NSApplicationDefined)
ProcessApplicationDefinedEvent(event);
else
[NSApp sendEvent : event];
}
while ((event = [NSApp nextEventMatchingMask : NSAnyEventMask
untilDate : nil inMode : NSDefaultRunLoopMode dequeue : YES]))
{
if (event.type == NSApplicationDefined)
ProcessApplicationDefinedEvent(event);
else
[NSApp sendEvent : event];
}
...
}
I have no knowledge about how it should be done with OSX but I tried to replicate the code in TUnixSystem.cxx
void TUnixSystem::DispatchOneEvent(Bool_t pendingOnly)
{
...
if (fNfd < 0 && fNfd != -2) {
int fd, rc;
TFdSet t;
for (fd = 0; fd < mxfd; fd++) {
t.Set(fd);
if (fReadmask->IsSet(fd)) {
rc = UnixSelect(fd+1, &t, 0, 0);
if (rc < 0 && rc != -2) {
SysError("DispatchOneEvent", "select: read error on %d", fd);
fReadmask->Clr(fd);
}
}
...
t.Clr(fd);
}
}
...
}
In that case no more trouble with IsSet() crashing…but I can no longer interact with the histograms ( mouse event are no longer dispatched I guess…)
Running OSX El Capitan, had the problem with Yosemite already.
$uname -a
Darwin MacBook-Pro-2.local 15.6.0 Darwin Kernel Version 15.6.0: Mon Aug 29 20:21:34 PDT 2016; root:xnu-3248.60.11~1/RELEASE_X86_64 x86_64
Tested with root 5.34.30 and 6.06
EDIT: Forgot to say everything is running smoothly on various linux distribution. Problem only occurs on OSX