I was receiving sporadic sigaborts when dealing with mouse events in long running tests. When I turn on zombie tracking it appears it is due to access of an NSEvent that had already been released. Anyone else running into this ?
It seems to me since the CCEventDispatcher methods queueEvent and dispatchQueuedEvents are accessed by two different threads, access to the eventQueue array and eventQueueCount needs to be synchronized. This appears to have fixed the error for me but before I open the bug I wanted to see if anyone else is seeing this or if I'm missing something ? My current fix (against cocos 0.99.5) is :
#if CC_DIRECTOR_MAC_USE_DISPLAY_LINK_THREAD
-(void) queueEvent:(NSEvent*)event selector:(SEL)selector
{
@synchronized (self) {
NSAssert( eventQueueCount < QUEUE_EVENT_MAX, @"CCEventDispatcher: recompile. Increment QUEUE_EVENT_MAX value");
eventQueue[eventQueueCount].selector = selector;
eventQueue[eventQueueCount].event = [event copy];
eventQueueCount++;
}
}
-(void) dispatchQueuedEvents
{
@synchronized (self) {
for( int i=0; i < eventQueueCount; i++ ) {
SEL sel = eventQueue[i].selector;
NSEvent *event = eventQueue[i].event;
[self performSelector:sel withObject:event];
[event release];
}
eventQueueCount = 0;
}
}
#endif