|
2020-10-23
| ||
| 16:52 | • Closed ticket [837b5a3a6c]: Aqua : crash with savePanel plus 8 other changes artifact: 16080dda5d user: marc_culler | |
|
2020-10-22
| ||
| 22:28 | • Ticket [837b5a3a6c]: 3 changes artifact: 31f4826f9f user: nab | |
| 22:08 | • Ticket [837b5a3a6c]: 4 changes artifact: b52b2cb36a user: marc_culler | |
| 20:56 | • Ticket [837b5a3a6c]: 3 changes artifact: 58431dcbe8 user: nab | |
| 20:08 | • Ticket [837b5a3a6c]: 3 changes artifact: 12fa8384ee user: nab | |
| 20:06 | • Ticket [837b5a3a6c]: 3 changes artifact: 38ff48e122 user: nab | |
| 20:05 | • Ticket [837b5a3a6c]: 3 changes artifact: 20f065fd3a user: nab | |
| 20:04 | • Ticket [837b5a3a6c]: 4 changes artifact: f244c8657d user: marc_culler | |
| 19:57 | • Ticket [837b5a3a6c]: 4 changes artifact: abdc0529dd user: marc_culler | |
| 19:54 | • Ticket [837b5a3a6c]: 3 changes artifact: 4981b62226 user: nab | |
| 19:52 | • Ticket [837b5a3a6c]: 3 changes artifact: e6c609642f user: nab | |
| 19:25 | • Ticket [837b5a3a6c]: 4 changes artifact: fd84b4122a user: marc_culler | |
| 16:14 | • Ticket [837b5a3a6c]: 3 changes artifact: 9fb344448b user: nab | |
| 16:13 | • Add attachment savePanelIssue.tcl to ticket [837b5a3a6c] artifact: 2e51eecde2 user: nab | |
| 14:43 | • Ticket [837b5a3a6c] Aqua : crash with savePanel status still Open with 4 other changes artifact: a8eff361d1 user: marc_culler | |
| 11:31 | • New ticket [837b5a3a6c]. artifact: d053e125e1 user: nab | |
| Ticket UUID: | 837b5a3a6c5b6e7ab87e9d93cbe69f07741d77b3 | |||
| Title: | Aqua : crash with savePanel | |||
| Type: | Bug | Version: | ||
| Submitter: | nab | Created on: | 2020-10-22 11:31:29 | |
| Subsystem: | 66. Aqua Window Operations | Assigned To: | marc_culler | |
| Priority: | 5 Medium | Severity: | Minor | |
| Status: | Closed | Last Modified: | 2020-10-23 16:52:17 | |
| Resolution: | Works For Me | Closed By: | marc_culler | |
| Closed on: | 2020-10-23 16:52:17 | |||
| Description: |
Hi Marc, using latest mac_styles branch on macOS Catalina compiled with Xcode (command line tools) 12.1. in my app when I want to save a file over a file that ever exists, macOS ask me if I want to replace the file, hit yes, then crash. nico@love ~ % /Users/nico/daylight/DLight.app/Contents/MacOS/DLight 8.6.10 2020-10-22 11:38:31.204 DLight[6026:1680354] WARNING: <NSSavePanel: 0x7ff57a994720> found it necessary to prepare implicitly; please prepare panels using NSSavePanel rather than NSApplication or NSWindow. 2020-10-22 11:38:32.205 DLight[6026:1680354] WARNING: <NSSavePanel: 0x7ff57a994720> found it necessary to start implicitly; please start panels using NSSavePanel rather than NSApplication or NSWindow. 2020-10-22 11:38:32.205 DLight[6026:1680354] WARNING: <NSSavePanel: 0x7ff57a994720> running implicitly; please run panels using NSSavePanel rather than NSApplication. 2020-10-22 11:38:32.207 DLight[6026:1680354] *** Assertion failure in -[NSSavePanel _attachSandboxExtensions:toURL:orURLs:], /AppleInternal/BuildRoot/Library/Caches/com.apple.xbs/Sources/AppKit/AppKit-1894.60.100/Nav.subproj/OpenAndSavePanelRemote/NSVBOpenAndSavePanels.m:718 2020-10-22 11:38:32.222 DLight[6026:1680354] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'ROSP: sandbox extension failure: nil result or wrong class type ((null)) for finalURL (file:///Users/nico/Documents/nicoBats_multiColour_13ch, /Users/nico/Documents/nicoBats_multiColour_13ch)!' *** First throw call stack: ( 0 CoreFoundation 0x00007fff32601b57 __exceptionPreprocess + 250 1 libobjc.A.dylib 0x00007fff6b4775bf objc_exception_throw + 48 2 CoreFoundation 0x00007fff3262ad08 +[NSException raise:format:arguments:] + 88 3 Foundation 0x00007fff34d1ce9d -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 191 4 AppKit 0x00007fff301eabb0 -[NSSavePanel _attachSandboxExtensions:toURL:orURLs:] + 420 5 AppKit 0x00007fff301eaf22 -[NSSavePanel _URLWithSecurityScoped:] + 194 6 Tk 0x00000001043946a7 Tk_MacOSXTkOwnsCursor + 663 7 Tk 0x0000000104396948 Tk_MacOSXTkOwnsCursor + 9528 8 Tcl 0x00000001041619d1 Tcl_GetVersion + 1921 9 Tcl 0x000000010415da02 Tcl_EvalObjv + 370 10 Tcl 0x000000010415f2db Tcl_EvalEx + 2795 11 Tcl 0x00000001042213ad Tcl_ParseVar + 925 12 Tcl 0x000000010415ef3f Tcl_EvalEx + 1871 13 Tcl 0x000000010415e80a Tcl_EvalEx + 26 14 DLight 0x0000000103e42627 exportFixturePersonality + 471 ) libc++abi.dylib: terminating with uncaught exception of type NSException zsh: abort /Users/nico/daylight/DLight.app/Contents/MacOS/DLight please tell me if can I do something about that or if you can do something about that. ++ nicolas | |||
| User Comments: |
marc_culler (claiming to be Marc Culler) added on 2020-10-23 16:52:17:
I tried your script with -filetypes {} -defaultextension {} and it also worked
fine. No crash. No warnings.
I am pretty sure the cause of the crash was that you had somehow accidentally
set the Wish app to run in a sandbox. A couple of things to check would be:
* look in ~/Library/Containers for anything related to tcl tk Wish or your app
* follow the instructions in the macosx/README file to see how many Wish.app
apps lsregister knows about. (Similarly for your app.)
Since the crash is gone, and I see no warnings, I think I can close this now.
There is no way to prevent an NSSavePanel from verifying that you want to
overwrite a file. The confirmoverwrite option cannot be supported on macOS.
nab added on 2020-10-22 22:28:30: as you can see in the script I just call tk_getSaveFile. I've tried -confirmoverwrite 0 option and this does not work. The 'replace/cancel' subpanel is still opening. (but that's another story I guess) >Where are you seeing those warnings, anyway? I don't see anything like that, even in the Console app. But I thought your app was launched from a dock icon. let's talk about Wish. I'm starting Wish from the terminal with the script as argument. I see those messages in the terminal. ++ marc_culler (claiming to be Marc Culler) added on 2020-10-22 22:08:52: Well, that is the exact opposite of what I expected. And I suspect it really has to do with recompiling the Wish app which causes some hidden extra attributes to change. We *are* preparing the panel using NSSavePanel, as far as I can see. But some people claim that the warning is actually caused by calling [NSSavePanel runModal]. I spent my morning trying to figure out how to avoid calling that. But nothing that I came up with worked. But I did make a change to *prepare* the panel by calling [NSSavePanel beginWithCompletionHandler:] which is how you "prepare" the NSSavePanel, as far as I can tell. Maybe you can figure out some way to avoid calling [NSSavePanel runModal]. Where are you seeing those warnings, anyway? I don't see anything like that, even in the Console app. But I thought your app was launched from a dock icon. nab added on 2020-10-22 20:56:23: using the latest mac_styles branch, neither Wish or my app crash. on both I got this message: 2020-10-22 22:48:31.491 Wish[8142:39082] WARNING: <NSSavePanel: 0x7fa1ff68fd90> found it necessary to prepare implicitly; please prepare panels using NSSavePanel rather than NSApplication or NSWindow. 2020-10-22 22:48:32.490 Wish[8142:39082] WARNING: <NSSavePanel: 0x7fa1ff68fd90> found it necessary to start implicitly; please start panels using NSSavePanel rather than NSApplication or NSWindow. 2020-10-22 22:48:32.490 Wish[8142:39082] WARNING: <NSSavePanel: 0x7fa1ff68fd90> running implicitly; please run panels using NSSavePanel rather than NSApplication. nab added on 2020-10-22 20:08:40: same crash I've used /private/tmp/testSavePanelFile ++ nab added on 2020-10-22 20:06:17: >What happens if you save the file in /tmp instead of in your home directory? let me try nab added on 2020-10-22 20:05:38: I've restarted the computer as we know sometimes it can lead to bad behaviour and still crash. >Did you delete your build directory completely? yes >I dismiss the dialog about overwriting the file and then the file dialog closes and everything is fine. just to be clear, the crash occurs when I hit 'replace' in the dialog that tells me that the file ever exists ++ marc_culler (claiming to be Marc Culler) added on 2020-10-22 20:04:15: Here is a stack overflow report of the same crash with an XCode app. It does not seem to have been resolved. The suggested "fix" was to catch the exception. That does not really solve the problem. https://stackoverflow.com/questions/60618321/using-cocoa-nssavepanel-in-non-sandboxed-causes-assertion-failure What happens if you save the file in /tmp instead of in your home directory? marc_culler (claiming to be Marc Culler) added on 2020-10-22 19:57:10: Yes, I saved the file many times. I dismiss the dialog about overwriting the file and then the file dialog closes and everything is fine. There is no bugfix branch but I will merge core-8-6-branch into mac_styles. (Although I was testing with the same tip that you were using.) Did you delete your build directory completely? nab added on 2020-10-22 19:54:11: this is the crash log when using Wish. 2020-10-22 18:12:32.791 Wish[25212:1814326] WARNING: <NSSavePanel: 0x7f988963a8c0> found it necessary to prepare implicitly; please prepare panels using NSSavePanel rather than NSApplication or NSWindow. 2020-10-22 18:12:33.791 Wish[25212:1814326] WARNING: <NSSavePanel: 0x7f988963a8c0> found it necessary to start implicitly; please start panels using NSSavePanel rather than NSApplication or NSWindow. 2020-10-22 18:12:33.791 Wish[25212:1814326] WARNING: <NSSavePanel: 0x7f988963a8c0> running implicitly; please run panels using NSSavePanel rather than NSApplication. 2020-10-22 18:12:33.792 Wish[25212:1814326] *** Assertion failure in -[NSSavePanel _attachSandboxExtensions:toURL:orURLs:], /AppleInternal/BuildRoot/Library/Caches/com.apple.xbs/Sources/AppKit/AppKit-1894.60.100/Nav.subproj/OpenAndSavePanelRemote/NSVBOpenAndSavePanels.m:718 2020-10-22 18:12:33.793 Wish[25212:1814326] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'ROSP: sandbox extension failure: nil result or wrong class type ((null)) for finalURL (file:///Users/nico/testSavePanelFile, /Users/nico/testSavePanelFile)!' *** First throw call stack: ( 0 CoreFoundation 0x00007fff32601b57 __exceptionPreprocess + 250 1 libobjc.A.dylib 0x00007fff6b4775bf objc_exception_throw + 48 2 CoreFoundation 0x00007fff3262ad08 +[NSException raise:format:arguments:] + 88 3 Foundation 0x00007fff34d1ce9d -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 191 4 AppKit 0x00007fff301eabb0 -[NSSavePanel _attachSandboxExtensions:toURL:orURLs:] + 420 5 AppKit 0x00007fff301eaf22 -[NSSavePanel _URLWithSecurityScoped:] + 194 6 Tk 0x000000010f4af6a7 Tk_MacOSXTkOwnsCursor + 663 7 Tk 0x000000010f4b1948 Tk_MacOSXTkOwnsCursor + 9528 8 Tcl 0x000000010f5719d1 Tcl_GetVersion + 1921 9 Tcl 0x000000010f56da02 Tcl_EvalObjv + 370 10 Tcl 0x000000010f56f347 Tcl_EvalEx + 2903 11 Tcl 0x000000010f56e80a Tcl_EvalEx + 26 12 Tk 0x000000010f3e4065 Tk_BindEvent + 6805 13 Tk 0x000000010f3eb2d8 TkBindEventProc + 360 14 Tk 0x000000010f3f302f Tk_HandleEvent + 879 15 Tk 0x000000010f3f3634 Tk_QueueWindowEvent + 548 16 Tcl 0x000000010f62a61c Tcl_ServiceEvent + 156 17 Tcl 0x000000010f62a8f8 Tcl_DoOneEvent + 376 18 Tk 0x000000010f3f3b5b Tk_MainLoop + 43 19 Tk 0x000000010f404f69 Tk_MainEx + 1657 20 Wish 0x000000010f3cf14f Wish + 12623 21 libdyld.dylib 0x00007fff6c61fcc9 start + 1 22 ??? 0x0000000000000002 0x0 + 2 ) libc++abi.dylib: terminating with uncaught exception of type NSException zsh: abort /Users/nico/daylight/lib/framework/build/tk/Wish.app/Contents/MacOS/Wish nab added on 2020-10-22 19:52:44: >I am puzzled by the "sandbox extension feature" in your crash report. Are you running your app in a sandbox? no >I am not able to replicate your crash. did you tried to save file 2x times? also would it be possible to have a bugfix branch derivated from mac_styles? ++ marc_culler (claiming to be Marc Culler) added on 2020-10-22 19:25:42: I am not able to replicate your crash. I tried on Catalina with Xcode 12.1 using mac_styles, core-8-6-branch and core-8-6-11-rc. I also tried on Big Sur using XCode 12.0 with core-8-6-branch. The script that you attached does not crash for me. I did find something which I think might stop the warnings, although I do not get those warnings. I will make that change in 8.6. I am puzzled by the "sandbox extension feature" in your crash report. Are you running your app in a sandbox? nab added on 2020-10-22 16:14:18: Hi Marc, attached script do make Tk to crash the file extension is given... ++ marc_culler (claiming to be Marc Culler) added on 2020-10-22 14:43:57: The internet can be helpful. Here is a discussion of this: https://developer.apple.com/forums/thread/75030 The problem seems to be related to the fact that you are saving a file to a filename that has no extension, and hence no file type known to the OS. Perhaps the existing file had a filetype recorded in its extra attributes or somewhere -- I would test this by creating a new file with your app and then trying to save over it. But I suspect the crash will occur whenever there is no extension on the filename. Maybe we have to disallow saving files with no extension. What are you specifying as the allowed file types in your save panel? I think you could fix this by requiring your file names to have an extension, and specifying that extension as the required file type in your save panel. You could try using .txt. Tk shouldn't crash. It should somehow detect this issue and handle it before the crash. But I don't know exactly what conditions lead to this. That is something that you should be able to test. I am sure it does not have anything to do with your app, but just the save panel. I will fix the warnings in a bugfix branch while you prepare a simple script to demonstrate the bug, by using the same settings for the save panel that you are using in your app. | |||
Attachments:
- savePanelIssue.tcl [download] added by nab on 2020-10-22 16:13:08. [details]