Handle lockDate being nil.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@14612 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Alexander Malmberg 2002-10-01 00:24:04 +00:00
parent 0c25ad4c32
commit 27e0aed83a
2 changed files with 14 additions and 2 deletions

View file

@ -1,3 +1,7 @@
2002-10-01 02:21 Alexander Malmberg <alexander@malmberg.org>
* Source/NSUserDefaults.m (-synchronize): Handle lockDate being nil.
2002-09-30 Richard Frith-Macdonald <rfm@gnu.org> 2002-09-30 Richard Frith-Macdonald <rfm@gnu.org>
* NSTimeZones/NSTimeZones.tar: Updated to latest information. * NSTimeZones/NSTimeZones.tar: Updated to latest information.

View file

@ -1184,10 +1184,18 @@ static NSString *pathForUser(NSString *user)
while ([_fileLock tryLock] == NO) while ([_fileLock tryLock] == NO)
{ {
CREATE_AUTORELEASE_POOL(arp); CREATE_AUTORELEASE_POOL(arp);
NSDate *when; NSDate *when, *lockDate;
lockDate = [_fileLock lockDate];
/* If the lock has already been released, lockDate will be nil. If
so, just try again. */
if (!lockDate)
{
RELEASE(arp);
continue;
}
when = [NSDate dateWithTimeIntervalSinceNow: 0.1]; when = [NSDate dateWithTimeIntervalSinceNow: 0.1];
if ([when timeIntervalSinceDate: [_fileLock lockDate]] > 5.0) if ([when timeIntervalSinceDate: lockDate] > 5.0)
{ {
[_fileLock breakLock]; [_fileLock breakLock];
} }