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: "Gary L. Wade" <email@hidden>
- Date: Mon, 19 Oct 2015 09:44:12 -0700
That looks familiar back when I dealt with adding an accessory view under sand boxing. I don't have the code base available to me to know what I did differently or remind me further, but I know I did something different in the sandboxed version than the non-sandboxed. There's a number of web pages you should find related to the save panel UI hierarchy under sand boxing that should help, though. Search on things like NSSavePanel, sandbox, NSRemoteView, etc.
--
Gary L. Wade (Sent from my iPhone)
http://www.garywade.com/
> On Oct 19, 2015, at 8:22 AM, Marek Hrušovský <email@hidden> wrote:
>
> I just went through my crashes and this thread popped up in google.
>
> I have additional information (one helpful method in the stack). Even if I
> dig deep I still can't figure out what can cause the issue. Is anyone able
> to get from "_hierarchyDidChangeInView" the line where it crashes?
>
>
> Anyway I created rdar://23165196
>
>
> Marek.
>
>
> Date/Time: 2015-10-14T19:16:34Z
>
> OS Version: Mac OS X 10.11.0 (15A278b)
>
> Report Version: 104
>
>
> Exception Type: SIGSEGV
>
> Exception Codes: SEGV_MAPERR at 0x7fc7a764438
>
> Crashed Thread: 0
>
>
> Thread 0 Crashed:
>
> 0 libobjc.A.dylib 0x00007fff84dcbe5d objc_msgSend +
> 29
>
> 1 ViewBridge 0x00007fff9519ea42
> -[NSVBAccessoryWindow _hierarchyDidChangeInView:] + 69
>
> 2 AppKit 0x00007fff86593aea -[NSView
> _setSuperview:] + 2602
>
> 3 AppKit 0x00007fff86592c28 -[NSView
> addSubview:] + 448
>
> 4 AppKit 0x00007fff865fa754 -[NSWindow
> setContentView:] + 638
>
> 5 ViewBridge 0x00007fff951d1253
> setWindowContentView + 75
>
> 6 ViewBridge 0x00007fff951b5d8b
> -[NSRemoteViewBase setAccessoryView:] + 208
>
> 7 AppKit 0x00007fff86df9ed8
> -[NSVBSavePanel(NSSavePanelSPI) _sendAccessoryView:] + 49
>
> 8 <com.myapp> 0x000000010b56e3b0 0x10b4bf000 + 717744
>
>> On Sat, Jul 18, 2015 at 12:14 AM, Martin Wierschin <email@hidden> wrote:
>>
>> 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