attempt fix for bug #36726

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@35263 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2012-07-08 12:03:09 +00:00
parent 445b29faa4
commit 5ac9b6a74e
3 changed files with 30 additions and 7 deletions

View file

@ -1,3 +1,11 @@
2012-07-08 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSURL.m:
* Source/NSURLHandle.m:
Re-load a cached handle if the content has been invalidated.
Set the status of a file handle to not-loaded if the fiel is modified.
Should fix bug #36726
2012-07-05 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSBundle.m: Don't assume that code loading won't be called

View file

@ -1732,13 +1732,20 @@ static NSUInteger urlAlign;
- (NSData*) resourceDataUsingCache: (BOOL)shouldUseCache
{
NSURLHandle *handle = [self URLHandleUsingCache: YES];
NSData *data;
NSData *data = nil;
if ([handle status] == NSURLHandleLoadSucceeded)
{
data = [handle availableResourceData];
}
if (shouldUseCache == NO || [handle status] != NSURLHandleLoadSucceeded)
{
[handle loadInForeground];
data = [handle loadInForeground];
}
if (nil == data)
{
data = [handle availableResourceData];
}
data = [handle availableResourceData];
return data;
}

View file

@ -529,7 +529,15 @@ static Class NSURLHandleClass = 0;
*/
- (NSData*) resourceData
{
if (_status != NSURLHandleLoadSucceeded)
NSData *d = nil;
if (NSURLHandleLoadSucceeded == _status)
{
d = [self availableResourceData];
}
if (nil == d
&& _status != NSURLHandleLoadSucceeded
&& _status != NSURLHandleLoadFailed)
{
if (_status == NSURLHandleLoadInProgress)
{
@ -537,15 +545,14 @@ static Class NSURLHandleClass = 0;
}
else
{
NSData *d = [self loadInForeground];
d = [self loadInForeground];
if (d != nil)
{
ASSIGNCOPY(_data, d);
}
}
}
return [self availableResourceData];
return d;
}
/* Private method ... subclasses override this to enable debug to be
@ -697,6 +704,7 @@ static NSLock *fileLock = nil;
// File has been modified
DESTROY(_data);
DESTROY(_attributes);
_status = NSURLHandleNotLoaded;
}
}
}