Some behavior changes based on testing on OSX

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@39983 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2016-07-12 11:31:45 +00:00
parent 16925d77b3
commit 769ce88f43
2 changed files with 11 additions and 9 deletions

View file

@ -3,6 +3,10 @@
* Source/GSICUString.m (UTextNSStringAccess):
Fix to use signed integer variables so all the comparisons with zero
as a boundary actually work as intended etc (spotted by Wolfgang).
* Source/NSRunLoop.m: Closer to OSX behavior ... a nil date is treated
like a date in the distant past (ie loop terminates at once), and the
(-runUntilDate:) method fires any pending timers when given a date in
the past.
2016-07-12 Wolfgang Lux <wolfgang.lux@gmail.com>

View file

@ -1301,7 +1301,7 @@ updateTimer(NSTimer *t, NSDate *d, NSTimeInterval now)
/* Find out how long we can wait before first limit date.
*/
d = [self limitDateForMode: mode];
if (d == nil)
if (nil == d || nil == date)
{
[arp drain];
return NO;
@ -1311,10 +1311,7 @@ updateTimer(NSTimer *t, NSDate *d, NSTimeInterval now)
* Retain the date in case the firing of a timer (or some other event)
* releases it.
*/
if (date != nil)
{
d = [d earlierDate: date];
}
d = [d earlierDate: date];
[d retain];
/* Wait, listening to our input sources. */
@ -1342,15 +1339,16 @@ updateTimer(NSTimer *t, NSDate *d, NSTimeInterval now)
*/
- (void) runUntilDate: (NSDate*)date
{
double ti = [date timeIntervalSinceNow];
BOOL mayDoMore = YES;
/* Positive values are in the future. */
while (ti > 0 && mayDoMore == YES)
while (YES == mayDoMore)
{
NSDebugMLLog(@"NSRunLoop", @"run until date %f seconds from now", ti);
mayDoMore = [self runMode: NSDefaultRunLoopMode beforeDate: date];
ti = [date timeIntervalSinceNow];
if (nil == date || [date timeIntervalSinceNow] <= 0.0)
{
mayDoMore = NO;
}
}
}