I ran the script (called “The script being run.scpt”) and all the text in the window disappeared and an “Internal error” dialog came up. I copied the text in the details of the dialog and then clicked the crash button for SD7-full. I ran the script after SD7-Full came back up and it ran no problems. This one surprised me because it is such a simple script and I hadn’t gotten to doing anything nasty to SD7 yet. All I did is type it in and click the “Begin” button. I hadn’t done anything else with the script.
I also included the console output for a little bit before the crash in case something of value is in the log. Nothing stood out to me as important but you are the expert here.
I enclosed 5 files in this post in a zipped file called The crash files.zip
Script Debugger Internal error.txt
Script Debugger crash report.txt
Apple crash report.txt
The script being run.scpt
Console output before the crash.txt
Here is the script I ran:
use framework "Foundation"
set StartingDate to current application's NSDate's |date|()
delay 1
set EndDate to current application's NSDate's |date|()
set TheInterval to (EndDate's timeIntervalSinceDate:StartingDate)
TheInterval as integer
No crash here, even with my modification. (Took 94 seconds OMM)
use framework "Foundation"
set StartingDate to current application's NSDate's |date|()
repeat 1000000 times
set EndDate to current application's NSDate's |date|()
end repeat
set TheInterval to (EndDate's timeIntervalSinceDate:StartingDate)
TheInterval as integer
But then I opened the log and ran this version, and it did crash:
use framework "Foundation"
set StartingDate to current application's NSDate's |date|()
repeat 10000 times
set EndDate to current application's NSDate's |date|()
log EndDate
end repeat
set TheInterval to (EndDate's timeIntervalSinceDate:StartingDate)
TheInterval as integer
But this is likely to be a log caused crash as anything else
You may not want to try to reproduce this crash. It seems to have left my system in an unstable state. First time I ran the logging version it was logging, with dates appearing in the log before it crashed.
Next two times nothing in the log. it just crashed.
Next I removed the repeat loop and ran it and got a single entry in the log. Put the repeat back in and bingo, crash.
use framework "Foundation"
set StartingDate to current application's NSDate's |date|()
repeat 10000 times
set EndDate to current application's NSDate's |date|()
log EndDate
end repeat
set TheInterval to (EndDate's timeIntervalSinceDate:StartingDate)
TheInterval as integer
Pasted this in at home and ran it. No problem, took 5 seconds. Clicked the toolbar icon to show the log and it crashed.
TL&DR: The log command should be passed AppleScript objects only — never AppleScriptObjC values. Doing the latter risks crashing Script Debugger (and any other editor).
The longer version: When you pass an ASObjC value to the log command, the result it returns includes a pointer to that object. In this case, you’re making lots of NSDate objects that you’re not using, and it looks like at some stage AppleScript is doing some garbage collection and deallocating them. When you go to show the log you’re attempting to access those objects after they have been deallocated, which is a guaranteed way to crash any application (and can’t be trapped).