Application quits when clicking "Ok" button is NSBeginCriticalAlertSheet in Tiger OS I am in a admin account when testing the issue. Please see ISSUE 1 and ISSUE 2 ISSUE 1: Ive created a User Interface to add a print queue using lpadmin. In my User Interface, i set my authorization not as admin. before my lpa dmin was called, an authentication dialog asking for user name and password appears which is expected since i set my authorization to 0. When i click "Cancel" in the authentication dialog, i raised my NSBeginCriticalAlertSheet stating "queue not added". When clicking "OK" button from my NSBeginCriticalAlertSheet, my application quits. here is the crash log: Exception: EXC_BAD_ACCESS (0x0001) Codes: KERN_INVALID_ADDRESS (0x0001) at 0x00633000 Thread 0 Crashed: 0 com.apple.Foundation 0x92bdfdc0 _NSAddExceptionHandlerForLock + 332 1 com.apple.AppKit 0x937caec4 -[NSViewHierarchyLock lockForReadingWithExceptionHandler:] + 368 2 com.apple.AppKit 0x937d02a0 -[NSView displayIfNeeded] + 80 3 com.apple.AppKit 0x93856f34 -[NSControl mouseDown:] + 184 4 com.apple.AppKit 0x937f8890 -[NSWindow sendEvent:] + 4616 5 com.apple.AppKit 0x937a18d4 -[NSApplication sendEvent:] + 4172 6 com.apple.AppKit 0x93798d10 -[NSApplication run] + 508 7 com.apple.AppKit 0x9388987c NSApplicationMain + 452 ISSUE 2: Ive created a User Interface to add a print queue using lpadmin. In my User Interface, i set my authorization not as admin. before my lpadmin was called, an authentication dialog asking for user name and password appears which is expected since i set my authorization to 0. When i click "Ok" in the authentication dialog without inputting the correct username and password, i raised my NSBeginCriticalAlertSheet stating "queue not added". When clicking "OK" button from my NSBeginCriticalAlertSheet, my application quits. here is the crash log: Exception: EXC_BAD_ACCESS (0x0001) Codes: KERN_PROTECTION_FAILURE (0x0002) at 0x004f5000 (null Unknown thread crashed with PPC Thread State 64: srr0: 0x0000000092bbc180 srr1: 0x000000000000d030 vrsave: 0x0000000000000000 cr: 0x42000222 xer: 0x0000000020000004 lr: 0x0000000092bbc180 ctr: 0x00000000900017a0 r0: 0x0000000092bbc180 r1: 0x00000000f01017d0 r2: 0x0000000054485244 r3: 0x0000000000000000 r4: 0x0000000000000000 r5: 0x000000000000000d r6: 0x00000000fffffff7 r7: 0x0000000000000003 r8: 0x0000000063303000 r9: 0x00000000f01015f5 r10: 0x0000000000000001 r11: 0x00000000a00061ec r12: 0x00000000900017a0 r13: 0x0000000000000000 r14: 0x0000000000000000 r15: 0x0000000000000000 r16: 0x0000000000000000 r17: 0x0000000000000000 r18: 0x0000000000000000 r19: 0x0000000000000000 r20: 0x0000000000000000 r21: 0x0000000000000000 r22: 0x0000000000000000 r23: 0x0000000000000000 r24: 0x0000000000000000 r25: 0x0000000000000002 r26: 0x00000000a37cd830 r27: 0x000000000035e590 r28: 0x00000000003835a0 r29: 0x000000000035c8d0 r30: 0x00000000003a8220 r31: 0x0000000092beb2dc here are my snippet codes: -(BOOL) createQueue : (AuthorizationRef) authRef { //launch authentication dialog. } - (void)errorSheet:(NSNotification*)aNotification { //raise error dialog NSBeginCriticalAlertSheet(@"failed", button1, button2, button3, nil,self,nil, @selector (sheetDidEnd:returnCode:contextInfo:),nil,@"queue not added"); } -(void)sheetDidEnd:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo { //recover error from errorSheet [[NSNotificationCenter defaultCenter] postNotification:[NSNotification notificationWithName:@"recoverfromfail" object:niluserInfo: [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:(returnCode==NSAlertDefaultReturn)?YES:NO],@"recover",nil]]]; } + (BOOL)runAsAdmin { OSStatus status; AuthorizationRef authorizationRef; AuthorizationItem right = { "com.mycompany.myapplication.command1", 0, NULL, 0 }; AuthorizationRights rightSet = { 0, &right };/*----------------------------------- intentionally set to 0 so that i will prompt an authenticaion dialog---------------------------------------*/ AuthorizationFlags flags = kAuthorizationFlagExtendRights | kAuthorizationFlagInteractionAllowed; /* Create a new AuthorizationRef object, but pass in NULL for the AuthorizationRights set so the AuthorizationRef can be used in future calls. */ status = AuthorizationCreate(NULL, kAuthorizationEmptyEnvironment, kAuthorizationFlagDefaults, &authorizationRef); if (status == errAuthorizationSuccess) { /* Now we can use the AuthorizationRef to deterimine if the user is allowed to perform the rights contained in "rightSet". */ status = AuthorizationCopyRights(authorizationRef, &rightSet, kAuthorizationEmptyEnvironment, flags, NULL); } } Static AuthorizationRef authRef = NULL; +(AuthorizationRef)authRef { returnauthRef; }
__________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]