• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
NSInvocation in a sheet
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSInvocation in a sheet


  • Subject: NSInvocation in a sheet
  • From: "Gerriet M. Denkmann" <email@hidden>
  • Date: Wed, 22 Aug 2007 18:17:32 +0200

In a subclass of NSDocument I do:

- (void)saveToURL:(NSURL *)absoluteURL ofType:(NSString *)typeName....
{
	//	do some checking

if ( all_is_fine ) // just do it
{
[ super saveToURL: absoluteURL ofType: typeName... // works as expected
}
else // ask the user, if they really know what they are doing
{
SEL selector = @selector(saveToURL:ofType:f...) ;
NSMethodSignature *signature = [ self methodSignatureForSelector: selector ];
NSInvocation *inv = [ NSInvocation invocationWithMethodSignature: signature ];
[ inv setSelector: selector ];
[ inv setArgument: &absoluteURL atIndex: 2 ];
[ inv setArgument: &typeName atIndex: 3 ];
....
[ inv retainArguments ];
[ inv retain ];
NSLog(@"%s NSInvocation %p %@",__FUNCTION__, inv, inv); // looks ok
NSBeginAlertSheet(...., inv, msg );
}
}


- (void)sheetDidEnd:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo;
{
NSInvocation *inv = contextInfo;
NSLog(@"%s NSInvocation %p",__FUNCTION__, inv); // address is ok


	NSLog(@"%s NSInvocation %@",__FUNCTION__, inv);	// this does crash
	//	"inv" is not a valid object anymore; the isa pointer is messed up
}

So: what am I doing wrong?
What can I make better?

Gerriet.

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Prev by Date: Re: Updating bound controls with selection change
  • Next by Date: Re:
  • Previous by thread: Re: Objective-C questions
  • Next by thread: webkit/cocoa app for consuming data
  • Index(es):
    • Date
    • Thread