Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NFD_SaveDialog crashed when overwrite file in macOS 10.15 #76

Closed
dom607 opened this issue Nov 1, 2019 · 3 comments
Closed

NFD_SaveDialog crashed when overwrite file in macOS 10.15 #76

dom607 opened this issue Nov 1, 2019 · 3 comments

Comments

@dom607
Copy link

dom607 commented Nov 1, 2019

Compilation Environment

  • OS : OSX 10.15.1
  • Compiler : Apple LLVM Clang
  • Compiler Version : I don't know exactly but use toolchains in Xcode 11.2
  • Build directory used : cmake-build-release
  • Have I attempted to reproduce the problem on the devel branch? : Nope

Describe the bug

My application was crashed when overwrite file with NFD_SaveDialog. There is no problem recording a new file. My application executed by terminal which registered as developer tool in privacy. This issue only occurs in after macOS 10.15. It has been identified to occur in the following situations:

  • Overwrites a file without changing dialog's default path and name. In other words, this occurs if the file is overwritten as soon as the Save button is pressed without any action.

Compilation output

WARNING: <NSSavePanel: 0x7f8b6ce62190> found it necessary to prepare implicitly; please prepare panels using NSSavePanel rather than NSApplication or NSWindow.
WARNING: <NSSavePanel: 0x7f8b6ce62190> found it necessary to start implicitly; please start panels using NSSavePanel rather than NSApplication or NSWindow.
WARNING: <NSSavePanel: 0x7f8b6ce62190> running implicitly; please run panels using NSSavePanel rather than NSApplication.
WARNING: <NSSavePanel: 0x7f8b6ce99f10> found it necessary to prepare implicitly; please prepare panels using NSSavePanel rather than NSApplication or NSWindow.
WARNING: <NSSavePanel: 0x7f8b6ce99f10> found it necessary to start implicitly; please start panels using NSSavePanel rather than NSApplication or NSWindow.
WARNING: <NSSavePanel: 0x7f8b6ce99f10> running implicitly; please run panels using NSSavePanel rather than NSApplication.
*** Assertion failure in -[NSSavePanel _attachSandboxExtensions:toURL:orURLs:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/AppKit/AppKit-1894.10.126/Nav.subproj/OpenAndSavePanelRemote/NSVBOpenAndSavePanels.m:717
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'unexpected class type for sandbox extension string!'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff2ebc0f53 __exceptionPreprocess + 250
1 libobjc.A.dylib 0x00007fff64c86835 objc_exception_throw + 48
2 CoreFoundation 0x00007fff2ebdc810 +[NSException raise:format:arguments:] + 88
3 Foundation 0x00007fff312bc5d1 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 191
4 AppKit 0x00007fff2c729357 -[NSSavePanel _attachSandboxExtensions:toURL:orURLs:] + 376
5 AppKit 0x00007fff2c72967c -[NSSavePanel _URLWithSecurityScoped:] + 194
6 PUFFVideoFilter 0x0000000102dff65b NFD_SaveDialog + 187
7 PUFFVideoFilter 0x0000000101eb205f _ZN7Context24SetOutputPathWithBrowserERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE + 95
8 PUFFVideoFilter 0x0000000101eb153b _ZN7Context6ShowUIEii + 6731
9 PUFFVideoFilter 0x0000000101eafa0e _ZN7Context6RenderEii + 46
10 PUFFVideoFilter 0x0000000101d3cc0e main + 6254
11 libdyld.dylib 0x00007fff65fe92e5 start + 1
12 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

User Description

I think the changed user privacy settings are causing problems. In this case, the system does not seem to think that the user has chosen the file. I got some hint from here HappenApps/Quiver#461 (comment)

@dom607
Copy link
Author

dom607 commented Nov 12, 2019

I found the cause of problem. Because of there are no default name for NSSavePannel.

@michaeladamkatz
Copy link

michaeladamkatz commented Dec 7, 2019

@dom607, thanks for posting this. I had the same problem and it helped me. I added
[panel setNameFieldStringValue: @"export" ];
before calling [panel runModal] and the crash went away.

I was led here by the backlink to #76

Same situation: only in MacOS 10.15, only when trying to save a file twice to the same directory (i.e., overwriting the file), and only when using the default savePanel settings (not changing directory, file name, etc.) -- "Overwrites a file without changing dialog's default path and name. In other words, this occurs if the file is overwritten as soon as the Save button is pressed without any action."

@mlabbe
Copy link
Owner

mlabbe commented Jan 8, 2021

Can't repro it on my system on the devel branch.

Build directory used : cmake-build-release <- this is not a supported build directory. Perhaps you are using a fork but reporting to me?

Please provide a repo with a full repro case and I will investigate.

@mlabbe mlabbe closed this as completed Jan 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants