[NSSavePanel savePanel] crashes with NSInternalInconsistencyException

Hi,


my non-sandboxed application sometimes crashes with a NSInternalInconsistencyException, reason: 'placeholder directory popup view must be set up before making a filebrowser view', when calling [NSSavePanel savePanel].


This is not happening 100% of the time (more 1%), and I cannot seem to find the reason for the crash.

This is the crash backtrace:

Application Specific Backtrace 1:
0   CoreFoundation                      0x00007fff8c2f62cb __exceptionPreprocess + 171
1   libobjc.A.dylib                     0x00007fffa110648d objc_exception_throw + 48
2   CoreFoundation                      0x00007fff8c2fb042 +[NSException raise:format:arguments:] + 98
3   Foundation                          0x00007fff8dd43be0 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 195
4   AppKit                              0x00007fff8a804f4b -[NSSavePanel(FileBrowserViewFileBrowserView) _makeFileBrowserView] + 143
5   AppKit                              0x00007fff8a46e2c0 -[NSSavePanel(NSSavePanelLayout) _setupFileBrowserView] + 169
6   AppKit                              0x00007fff8a46f911 -[NSSavePanel(NSSavePanelLayout) _initContentView] + 5125
7   AppKit                              0x00007fff8a45a83b -[NSSavePanel initWithContentRect:styleMask:backing:defer:] + 853
8   AppKit                              0x00007fff89fb6c0f +[NSSavePanel _crunchyRawUnbonedPanel] + 518


A detail that might have an importance, the call to [NSSavePanel savePanel] is make from a dylib, not from the main application module.


Any idea?

Thanks,

Chris

I've never had such a problem.


Which version of SCode and OSX ?

Can you show how you call NSSave and how you configure it ?

Hi,


I'm using MacOS 10.12.2 and Xcode 8.2.1.

As for the code, I'm not using it directly it's from the Juce toolkit, but is there any configuration to be done before calling a factory method??


The code crashes when it calls +[NSSavePanel savePanel] (but not 100% of the time)

Is there anything to configure before getting the NSSavePanel instance?


Thanks,

Chris

Only setting I do is title and prompt, like this:


        let savePanel = NSSavePanel()
        savePanel.title = "File to save"
        savePanel.prompt = "Save"


Uou'll probably have to contact juice directly if that does not work.

Yes, but you are setting it after you get your NSSavePanel instance.

My crash log is inside the NSSavePanel() call 😟


I can contact juce, but since it's inside a factory method of MacOS, I'm not sure they can do much about it.

Thanks anyway,

Chris


PS: Somebody else has an idea?

>> [NSSavePanel(FileBrowserViewFileBrowserView) _makeFileBrowserView]


Historically, NSavePanel has had trouble with its column view, trying to display a file preview in the last pane, and your crash appears to be happening during the setup of this preview.


Does the problem go away completely if you switch to list or icon view? Does the problem tend to occur with a particular file, or particular kind of file, selected in column view? If so, this preview issue may be the cause, and it may be outside your control.

Since the issue is not 100% reproducible it's hard to test easily, but you might be right (and that was my first idea): it should be related to something like this.

I had in mind it would be linked to some file present in the default folder, and that file being "previewed" by the OS causing the crash. Maybe a QuickLook plugin that fails to process the file and crashes (since it does not happen always and not on every mac computer or logged user).


I'll investigate more and try to answer here if I find something.

[NSSavePanel savePanel] crashes with NSInternalInconsistencyException
 
 
Q