Subject: bug#13229: 24.3.50; Crash with ns_run_ascript

From: Jan Djärv <[email-masked]>
Date: Sun, 23 Dec 2012 13:37:16 +0100

Hello.

This is a duplicate of 12969.  A fix for that bug has been checked in.

	Jan D.

19 dec 2012 kl. 18:25 skrev Carsten Bormann <[email-masked]>:

> I regularly use this little function:
> 
> (defun insert-safari-topmost ()
>  (interactive "*")
>  (insert
>   (substring
>    (do-applescript "
> tell application \"Safari\"
> set myUrl to URL of document 1 as string
> end tell
> return myUrl
> ")
>    1 -1))
>  (insert "\n")
>  (insert
>   (do-applescript "
> tell application \"Safari\"
> set myName to name of document 1 as string
> end tell
> return myName
> "))
>  (insert "\n"))
> 
> This little hack has worked perfectly for a couple of years.
> I try to stay relatively current with the nightlies on emacsformacosx, updating once a week or so.
> Recently (starting for me on December 7, probably based on an Emacs from
> December 4), this has developed a problem.
> Randomly (at maybe 1 % probability, with a pattern that I can't
> discern), this crashes like the below.
> Restarting Emacs, and performing the same Applescript in the same
> file with exactly the same environment and the same outcome then
> works, so it must be some slow deterioration or race condition.
> 
> Process:         Emacs-10.7 [1191]
> Path:            /Applications/Emacs.app/Contents/MacOS/Emacs-10.7
> Identifier:      org.gnu.Emacs
> Version:         Version 24.3.50 (9.0)
> Code Type:       X86-64 (Native)
> Parent Process:  launchd [263]
> User ID:         501
> 
> Date/Time:       2012-12-19 09:44:09.463 +0100
> OS Version:      Mac OS X 10.8.2 (12C60)
> Report Version:  10
> 
> Crashed Thread:  0  Dispatch queue: com.apple.main-thread
> 
> Exception Type:  EXC_BAD_ACCESS (SIGABRT)
> Exception Codes: EXC_I386_GPFLT
> 
> Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
> 0   libsystem_kernel.dylib        	0x00007fff84af3d46 __kill + 10
> 1   Emacs-10.7                    	0x000000010009cd19 terminate_due_to_signal + 153
> 2   Emacs-10.7                    	0x00000001000b9593 emacs_abort + 19
> 3   Emacs-10.7                    	0x00000001001880bd ns_term_shutdown + 125
> 4   Emacs-10.7                    	0x000000010009d381 shut_down_emacs + 305
> 5   Emacs-10.7                    	0x000000010009ccdb terminate_due_to_signal + 91
> 6   Emacs-10.7                    	0x00000001000b9b06 deliver_fatal_thread_signal + 134
> 7   libsystem_c.dylib             	0x00007fff86d468ea _sigtramp + 26
> 8   libsystem_c.dylib             	0x00007fff86d46650 strlen + 16
> 9   com.apple.Foundation          	0x00007fff8627a99c +[NSString stringWithUTF8String:] + 82
> 10  Emacs-10.7                    	0x000000010018deeb ns_run_ascript + 75
> 11  Emacs-10.7                    	0x000000010017dbbf -[EmacsApp sendEvent:] + 95
> 12  com.apple.AppKit              	0x00007fff8573b2fa -[NSApplication run] + 636
> 13  Emacs-10.7                    	0x000000010018a350 ns_read_socket + 560
> 14  Emacs-10.7                    	0x00000001000a88bf gobble_input + 271
> 15  Emacs-10.7                    	0x00000001000a8165 process_pending_signals + 21
> 16  Emacs-10.7                    	0x0000000100122070 internal_equal + 320
> 17  Emacs-10.7                    	0x000000010011e66d Fequal + 13
> 18  Emacs-10.7                    	0x000000010003bbef display_mode_element + 655
> 19  Emacs-10.7                    	0x000000010003d55d display_mode_element + 7165
> 20  Emacs-10.7                    	0x000000010003d4e2 display_mode_element + 7042
> 21  Emacs-10.7                    	0x000000010003d55d display_mode_element + 7165
> 22  Emacs-10.7                    	0x000000010003d55d display_mode_element + 7165
> 23  Emacs-10.7                    	0x000000010003d8dc display_mode_line + 364
> 24  Emacs-10.7                    	0x000000010003db30 display_mode_lines + 336
> 25  Emacs-10.7                    	0x000000010004b36f redisplay_window + 20879
> 26  Emacs-10.7                    	0x0000000100035676 redisplay_window_0 + 38
> 27  Emacs-10.7                    	0x0000000100116c83 internal_condition_case_1 + 307
> 28  Emacs-10.7                    	0x000000010003562c redisplay_windows + 140
> 29  Emacs-10.7                    	0x0000000100041d9c redisplay_internal + 4140
> 30  Emacs-10.7                    	0x00000001000aff82 command_loop_1 + 338
> 31  Emacs-10.7                    	0x0000000100116dd9 internal_condition_case + 297
> 32  Emacs-10.7                    	0x00000001000afe0e command_loop_2 + 62
> 33  Emacs-10.7                    	0x0000000100116ed5 internal_catch + 213
> 34  Emacs-10.7                    	0x00000001000b1840 recursive_edit_1 + 240
> 35  Emacs-10.7                    	0x00000001000a231d Frecursive_edit + 237
> 36  Emacs-10.7                    	0x000000010009f1c7 main + 5943
> 37  Emacs-10.7                    	0x0000000100001a14 start + 52
> [...]
> 
> Thread 0 crashed with X86 Thread State (64-bit):
>  rax: 0x0000000000000000  rbx: 0x0000000000000028  rcx: 0x00007fff5fbf6ee8  rdx: 0x0000000000000000
>  rdi: 0x00000000000004a7  rsi: 0x0000000000000006  rbp: 0x00007fff5fbf6f10  rsp: 0x00007fff5fbf6ee8
>   r8: 0xfffffffeff8e642f   r9: 0x00000000000001ff  r10: 0x00007fff84af423a  r11: 0x0000000000000206
>  r12: 0x00000001049e6980  r13: 0x0000000000000001  r14: 0x0000000000000006  r15: 0x00000000000004a7
>  rip: 0x00007fff84af3d46  rfl: 0x0000000000000206  cr2: 0x0000000100c015d8
> Logical CPU: 0
> 
> 
> 
> In GNU Emacs 24.3.50.1 (x86_64-apple-darwin, NS apple-appkit-1038.36)
> of 2012-12-17 on bob.porkrind.org
> Bzr revision: 111254 [email-masked]
> Windowing system distributor `Apple', version 10.3.1187
> Configured using:
> `configure '--host=x86_64-apple-darwin' '--build=i686-apple-darwin'
> '--with-ns' 'build_alias=i686-apple-darwin'
> 'host_alias=x86_64-apple-darwin' 'CC=gcc -mmacosx-version-min=10.7
> -isystem
> /Users/david/Xcode-10.7_4.5.2/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/include/
> -F/Users/david/Xcode-10.7_4.5.2/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks''
> 
> Important settings:
>  value of $LC_CTYPE: UTF-8
>  locale-coding-system: nil
>  default enable-multibyte-characters: t
> 
> 
> 
>