attempt to fix bug #39107

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@37995 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2014-07-14 08:24:30 +00:00
parent 250e0a4d7d
commit d5a9e89b41
2 changed files with 22 additions and 4 deletions

View file

@ -1,3 +1,8 @@
2014-07-14 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSRunLoop.m: ([-runMode:beforeDate:]) check performers as
well as notifications etc ... should fix bug #39107
2014-02-17 Larry Campbell <lcampbel@akamai.com>
* Source/NSJSONSerialization.m:

View file

@ -390,7 +390,7 @@ static inline BOOL timerInvalidated(NSTimer *t)
- (void) _addWatcher: (GSRunLoopWatcher*)item
forMode: (NSString*)mode;
- (void) _checkPerformers: (GSRunLoopCtxt*)context;
- (BOOL) _checkPerformers: (GSRunLoopCtxt*)context;
- (GSRunLoopWatcher*) _getWatcher: (void*)data
type: (RunLoopEventType)type
forMode: (NSString*)mode;
@ -429,9 +429,9 @@ static inline BOOL timerInvalidated(NSTimer *t)
}
}
- (void) _checkPerformers: (GSRunLoopCtxt*)context
- (BOOL) _checkPerformers: (GSRunLoopCtxt*)context
{
NSAutoreleasePool *arp = [NSAutoreleasePool new];
BOOL found = NO;
if (context != nil)
{
@ -440,12 +440,14 @@ static inline BOOL timerInvalidated(NSTimer *t)
if (count > 0)
{
NSAutoreleasePool *arp = [NSAutoreleasePool new];
GSRunLoopPerformer *array[count];
NSMapEnumerator enumerator;
GSRunLoopCtxt *context;
void *mode;
unsigned i;
found = YES;
/*
* Copy the array - because we have to cancel the requests
* before firing.
@ -492,9 +494,10 @@ static inline BOOL timerInvalidated(NSTimer *t)
RELEASE(array[i]);
IF_NO_GC([arp emptyPool];)
}
[arp drain];
}
}
[arp drain];
return found;
}
/**
@ -1243,6 +1246,8 @@ updateTimer(NSTimer *t, NSDate *d, NSTimeInterval now)
- (BOOL) runMode: (NSString*)mode beforeDate: (NSDate*)date
{
NSAutoreleasePool *arp = [NSAutoreleasePool new];
NSString *savedMode = _currentMode;
GSRunLoopCtxt *context;
NSDate *d;
NSAssert(mode != nil, NSInvalidArgumentException);
@ -1252,6 +1257,14 @@ updateTimer(NSTimer *t, NSDate *d, NSTimeInterval now)
GSPrivateCheckTasks();
GSPrivateNotifyASAP(mode);
/* And process any performers scheduled in the loop (eg something from
* another thread.
*/
_currentMode = mode;
context = NSMapGet(_contextMap, mode);
[self _checkPerformers: context];
_currentMode = savedMode;
/* Find out how long we can wait before first limit date.
*/
d = [self limitDateForMode: mode];