URL open panel: Fix invocation of completion handler so it doesn't crash
parent
bb1f9dcb33
commit
b2ae62a4db
|
@ -166,7 +166,6 @@ typedef id (*myIMP)(id, SEL, ...);
|
||||||
NSString *urlString;
|
NSString *urlString;
|
||||||
NSURL *url;
|
NSURL *url;
|
||||||
BOOL informDelegate = YES;
|
BOOL informDelegate = YES;
|
||||||
myIMP callback;
|
|
||||||
|
|
||||||
if ([sender tag] == NSModalResponseOK)
|
if ([sender tag] == NSModalResponseOK)
|
||||||
{
|
{
|
||||||
|
@ -218,8 +217,18 @@ typedef id (*myIMP)(id, SEL, ...);
|
||||||
// inform the delegate
|
// inform the delegate
|
||||||
if (informDelegate && mDelegate && mDidEndSelector)
|
if (informDelegate && mDelegate && mDidEndSelector)
|
||||||
{
|
{
|
||||||
callback = (myIMP) [mDelegate methodForSelector:mDidEndSelector];
|
NSInvocation *inv = [NSInvocation invocationWithMethodSignature:[mDelegate methodSignatureForSelector:mDidEndSelector]];
|
||||||
callback(mDelegate, mDidEndSelector, self, [sender tag], mContextInfo);
|
[inv setSelector:mDidEndSelector];
|
||||||
|
[inv setTarget:mDelegate];
|
||||||
|
|
||||||
|
OpenURLPanel *pself = self;
|
||||||
|
int tag = (int)([sender tag]);
|
||||||
|
|
||||||
|
[inv setArgument:&(pself) atIndex:2];
|
||||||
|
[inv setArgument:&(tag) atIndex:3];
|
||||||
|
[inv setArgument:&(mContextInfo) atIndex:4];
|
||||||
|
|
||||||
|
[inv invoke];
|
||||||
|
|
||||||
[self close];
|
[self close];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue