Newly saves application crashes on first launch


(Jim Brandt) #1

I have a large number of scripts I’ve written to perform creation of and delivery of commercial spots to TV stations. Most of these scripts I save as applications so I can dunmore that one of them at a time. After a period of time, the applications fail to run, crashing with a SIGSEVG error. Sometimes a reopen lets the script application run. Sometimes it doesn’t. When that happens, I open the source, and re-export the script as a run-only application.

Today, I tried to run one of these applications and it crashed immediately. So I opened the source, exported a Run Only application and tried to run it. It crashed immediately.

So what has happened that I can no longer save this script as an application?

It runs fine when executed within Script Debugger.

Jim Brandt


(Jim Brandt) #2

should be run more than, not dunmore that.


(Nigel Garvey) #3

Just guessing. Do your scripts store ASObjC values in persistent variables? Do they build large lists in persistent variables and not clear them before quitting? (A persistent variable is a property, a global, or a variable set in a run handler without being explicitly declared local.)


(Jim Brandt) #4

So ANY variable declared in a handler that’s not expliciately declared as global is persistent?

so:

set X to My_Handler(“text”)

on My_Handler(PassedString)
set cnt to 1
set Y to PassedString & (space & cnt as text)
return Y
end

cnt and Y are persistent variables?

Is this true in libraries also?

and if I wrote it as:

on My_Handler(PassedString)
local cnt, Y
set cnt to 1
set Y to PassedString & (space & cnt as text)
return Y
end

they wouldn’t be?


(Nigel Garvey) #5

Any variable in a run handler that’s not explicitly declared local is persistent. In the ordinary handlers above, cnt and Y are local by default and therefore non-persistent (unless declared global or as properties at the top of the script, of course). I don’t remember offhand what the situation is with open and idle handlers. Possibly the same as with run handlers.

I don’t think so. Only in scripts that are actually run.

Persistence itself isn’t necessarily a problem. Only if the variables contain huge list values or ASObjC pointers, which can’t be saved back to the script file. And I’m only guessing at this as a possible cause of the trouble you’re having.