mirror of
https://github.com/gnustep/libs-base.git
synced 2025-06-04 02:20:48 +00:00
fix leak
This commit is contained in:
parent
a021005af7
commit
b847a444b3
1 changed files with 85 additions and 66 deletions
|
@ -53,20 +53,22 @@ static NSMutableDictionary *__presenterIdDict = nil;
|
|||
options: (NSFileCoordinatorReadingOptions)options
|
||||
{
|
||||
NSFileAccessIntent *result = [[self alloc] init];
|
||||
|
||||
ASSIGNCOPY(result->_url, url);
|
||||
result->_options = options;
|
||||
result->_isRead = YES;
|
||||
return result;
|
||||
return AUTORELEASE(result);
|
||||
}
|
||||
|
||||
+ (instancetype) writingIntentWithURL: (NSURL *)url
|
||||
options: (NSFileCoordinatorWritingOptions)options
|
||||
{
|
||||
NSFileAccessIntent *result = [[self alloc] init];
|
||||
|
||||
ASSIGNCOPY(result->_url, url);
|
||||
result->_options = options;
|
||||
result->_isRead = NO;
|
||||
return result;
|
||||
return AUTORELEASE(result);
|
||||
}
|
||||
|
||||
- (NSURL *) URL
|
||||
|
@ -171,7 +173,9 @@ static NSMutableDictionary *__presenterIdDict = nil;
|
|||
if (readingOptions == 0L)
|
||||
{
|
||||
id<NSFilePresenter> p = [__presenterMap objectForKey: readingURL];
|
||||
if([p respondsToSelector: @selector(savePresentedItemChangesWithCompletionHandler:)])
|
||||
|
||||
if ([p respondsToSelector:
|
||||
@selector(savePresentedItemChangesWithCompletionHandler:)])
|
||||
{
|
||||
[p savePresentedItemChangesWithCompletionHandler: NULL];
|
||||
}
|
||||
|
@ -180,7 +184,9 @@ static NSMutableDictionary *__presenterIdDict = nil;
|
|||
if (writingOptions == 0L)
|
||||
{
|
||||
id<NSFilePresenter> p = [__presenterMap objectForKey: writingURL];
|
||||
if([p respondsToSelector: @selector(savePresentedItemChangesWithCompletionHandler:)])
|
||||
|
||||
if ([p respondsToSelector:
|
||||
@selector(savePresentedItemChangesWithCompletionHandler:)])
|
||||
{
|
||||
[p savePresentedItemChangesWithCompletionHandler: NULL];
|
||||
}
|
||||
|
@ -196,7 +202,8 @@ static NSMutableDictionary *__presenterIdDict = nil;
|
|||
if (options == 0L)
|
||||
{
|
||||
id<NSFilePresenter> p = [__presenterMap objectForKey: url];
|
||||
if([p respondsToSelector: @selector(savePresentedItemChangesWithCompletionHandler:)])
|
||||
if ([p respondsToSelector:
|
||||
@selector(savePresentedItemChangesWithCompletionHandler:)])
|
||||
{
|
||||
[p savePresentedItemChangesWithCompletionHandler: NULL];
|
||||
}
|
||||
|
@ -212,7 +219,8 @@ static NSMutableDictionary *__presenterIdDict = nil;
|
|||
if (options == 0L)
|
||||
{
|
||||
id<NSFilePresenter> p = [__presenterMap objectForKey: url];
|
||||
if([p respondsToSelector: @selector(savePresentedItemChangesWithCompletionHandler:)])
|
||||
if ([p respondsToSelector:
|
||||
@selector(savePresentedItemChangesWithCompletionHandler:)])
|
||||
{
|
||||
[p savePresentedItemChangesWithCompletionHandler: NULL];
|
||||
}
|
||||
|
@ -230,7 +238,9 @@ static NSMutableDictionary *__presenterIdDict = nil;
|
|||
if (options1 == 0L)
|
||||
{
|
||||
id<NSFilePresenter> p = [__presenterMap objectForKey: url1];
|
||||
if([p respondsToSelector: @selector(savePresentedItemChangesWithCompletionHandler:)])
|
||||
|
||||
if ([p respondsToSelector:
|
||||
@selector(savePresentedItemChangesWithCompletionHandler:)])
|
||||
{
|
||||
[p savePresentedItemChangesWithCompletionHandler: NULL];
|
||||
}
|
||||
|
@ -239,7 +249,9 @@ static NSMutableDictionary *__presenterIdDict = nil;
|
|||
if (options2 == 0L)
|
||||
{
|
||||
id<NSFilePresenter> p = [__presenterMap objectForKey: url2];
|
||||
if([p respondsToSelector: @selector(savePresentedItemChangesWithCompletionHandler:)])
|
||||
|
||||
if ([p respondsToSelector:
|
||||
@selector(savePresentedItemChangesWithCompletionHandler:)])
|
||||
{
|
||||
[p savePresentedItemChangesWithCompletionHandler: NULL];
|
||||
}
|
||||
|
@ -250,18 +262,22 @@ static NSMutableDictionary *__presenterIdDict = nil;
|
|||
- (void) itemAtURL: (NSURL *)oldURL didMoveToURL: (NSURL *)newURL
|
||||
{
|
||||
id<NSFilePresenter> presenter = [__presenterMap objectForKey: oldURL];
|
||||
|
||||
[presenter presentedItemDidMoveToURL: newURL];
|
||||
}
|
||||
|
||||
- (void) itemAtURL: (NSURL *)oldURL willMoveToURL: (NSURL *)newURL
|
||||
{
|
||||
id<NSFilePresenter> presenter = [__presenterMap objectForKey: oldURL];
|
||||
|
||||
[presenter presentedItemDidChange]; // there is no "Will" method for this, so I am a bit perplexed.
|
||||
}
|
||||
|
||||
- (void)itemAtURL: (NSURL *)url didChangeUbiquityAttributes: (NSSet *)attributes
|
||||
- (void) itemAtURL: (NSURL *)url
|
||||
didChangeUbiquityAttributes: (NSSet *)attributes
|
||||
{
|
||||
id<NSFilePresenter> presenter = [__presenterMap objectForKey: url];
|
||||
|
||||
[presenter presentedItemDidChangeUbiquityAttributes: attributes];
|
||||
}
|
||||
|
||||
|
@ -276,10 +292,13 @@ static NSMutableDictionary *__presenterIdDict = nil;
|
|||
{
|
||||
NSEnumerator *en = [readingURLs objectEnumerator];
|
||||
NSURL *aurl = nil;
|
||||
|
||||
while ((aurl = [en nextObject]) != nil)
|
||||
{
|
||||
id<NSFilePresenter> p = [__presenterMap objectForKey: aurl];
|
||||
if([p respondsToSelector: @selector(savePresentedItemChangesWithCompletionHandler:)])
|
||||
|
||||
if ([p respondsToSelector:
|
||||
@selector(savePresentedItemChangesWithCompletionHandler:)])
|
||||
{
|
||||
[p savePresentedItemChangesWithCompletionHandler: NULL];
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue