So this is what was occurring and it was all my fault (surprise!)
The preferences file was causing an error : I used an absolute path to describe a field which meant that when the standalone processed it the filepath to the stack was wrong because the the standalone was in a different folder. The standalone did not have any error traps so the startUsing message was never called. This meant that the calls made from the closeStack handler also generated an un-trapped error in the standalone because the handlers being called were in a substack that was not in the message path. The result was code that worked in the IDE but not in the build.
The solution was to reformat the data in the preference file using stack names rather than IDs and also to add "try" "catch" statements to catch any errors.
Here are the new close/quit handlers which I have placed in card 1 which is the only card:
Code: Select all
on closeStackRequest
-- if the mode of stack "revStandaloneProgress" > 0 then
-- exit closeStackRequest
-- end if
try
WritePreferenceFile
pass closeStackRequest
catch tError
answer "An error occurred in CloseStackRequest : " && tError
pass closeStackRequest
end try
end closeStackRequest
on shutdownRequest
try
WritePreferenceFile
pass shutdownRequest
catch tError
answer "An error occurred in handler : shutdownRequest : " && tError
pass shutdownRequest
end try
end shutdownRequest
The three lines that are commented out are copied from the release notes for LC version 9.0 and are intended for the CloseStack message. If they are uncommented they prevent the closeStackRequest from completing in the final standalone application.
So the problem is solved with a reason code of "idiot at the wheel!"
best wishes
Simon