Re: Safe time to add accessory view to NSSavePanel in sandboxed app?
Re: Safe time to add accessory view to NSSavePanel in sandboxed app?
- Subject: Re: Safe time to add accessory view to NSSavePanel in sandboxed app?
- From: Martin Wierschin <email@hidden>
- Date: Fri, 17 Jul 2015 15:14:54 -0700
I just had a beta tester contact me about a very similar error/crash. It's slightly different than I've seen before, but it certainly seems related.
The tester was closing a window backed by NSDocument. In response the AppKit document machinery was attempting to create an NSSavePanel, to allow the user to save or discard the file, but NSRemoteView threw an exception[1].
As I mentioned earlier in this thread, I've come to anticipate this. I now wrap the relevant NSDocument method to catch any exceptions and display a warning alert that the system save panel is (apparently) temporarily unavailable. This time the app crashed while trying to generate that alert; -[NSAlert init] was loading some localized string and crashed[2].
I doubt this is going to be reproducible, but it's reported as rdar://21881669.
~Martin Wierschin
[1] INITIAL EXCEPTION:
MyApp[807]: *** Assertion failure in -[NSRemoteView setServiceObject:forKey:], /SourceCache/ViewBridge/ViewBridge-105/NSRemoteView.m:3142
failed: <NSRemoteView:> invalid
in: NSInternalInconsistencyException line 0
STACK TRACE:
...
libobjc.A.dylib objc_exception_throw
CoreFoundation +[NSException raise:format:arguments:]
Foundation -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:]
ViewBridge -[NSRemoteViewBase setServiceObject:forKey:]
Foundation NSKeyValueNotifyObserver
Foundation NSKeyValueDidChange
Foundation -[NSObject(NSKeyValueObserverNotification) didChangeValueForKey:]
AppKit -[NSDocument _preparedSavePanelForOperation:]
...
AppKit -[NSDocument canCloseDocumentWithDelegate:shouldCloseSelector:contextInfo:]
AppKit -[NSWindow __close]
AppKit -[NSControl sendAction:to:]
...
AppKit NSApplicationMain
MyApp MyAppMain
MyApp start
[2] SUBSEQUENT CRASH:
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS atVM Regions Near:
...
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 com.apple.CoreServices.CarbonCore _CSGetNamedData
1 com.apple.CoreFoundation _CFPropertyListCopyShared
2 com.apple.CoreFoundation CFBundleCopyLocalizedStringForLocalization
3 com.apple.Foundation -[NSBundle localizedStringForKey:value:table:]
4 com.apple.AppKit -[NSAlert init]
5 com.apple.AppKit +[NSAlert alertWithMessageText:defaultButton:alternateButton:otherButton:informativeTextWithFormat:]
6 com.company.myapp __84-[MyApp delayedWarnAboutUnavailableSavePanel:]_block_invoke
7 libdispatch.dylib _dispatch_call_block_and_release
8 libdispatch.dylib _dispatch_client_callout
...
17 com.apple.AppKit -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:]
18 com.apple.AppKit -[NSApplication run]
19 com.apple.AppKit NSApplicationMain
20 com.company.myapp MyMain
21 com.company.myapp start
_______________________________________________
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