AppleScript droplet SIGBUS error

Has anyone experienced any problems with an AppleScript droplet application unexpectedly quitting? I wrote a simple script that would open files and extract some information from them (specifically FileMaker Developer) and it crashes at the end every single time.

But I then noticed that if I just create a new AppleScript droplet application and add nothing to the default code, it still crashes. The error message it throws back in Xcode is “testdroplet has exited due to signal 10 (SIGBUS)”. I’ve tried this on both a PowerBook and a G5 and I get the same result. At random times (although very infrequently), it will not crash. I’ve searched around on the Internet and there are a couple of people that had a similar problem but I haven’t been able to find any answers.

The only code in the script is as follows:

on idle
end idle

on open names
quit
end open

I’d greatly appreciate any assistance.

Greetings.

I’ve been active in a few posts about droplets and have seen the sigbus error a few times. It’s seems to be a logic/memory error that always crashes projects. Of course, my problems have always come after adding lots of (bad) code, and all have been related to bugs/inconsistencies with certain objects or processes.

Since you’re at bare minimum and still crashing I’d try:

Try cleaning and rebuilding your project. You may have a corrupted nib or some other corruption.

A good troubleshooting method is commenting out every line (not the handler definitions, though) and then methodically uncommenting them, which often helps me find which lines are no good. (Pretty simple for a one liner like yours. :wink: )

Try to add a bit of simple code to see if there needs to be something simple to avoid a conflict. Perhaps an alert or something easy…

on open names
  display dialog "Now I feel OK!"
end open

Remember that you need to drop something on a droplet to see it’s ‘on open’ action… assuming you can even get that far.

Otherwise you may have to uninstall and reinstall xcode, as it may be a corruption in your template file or in the xcode apps and resources themselves.

Sorry I can’t give you a solid answer, as I haven’t heard of any bugs or problems that effect everyone in this way.

Good luck…
j

Thanks for your suggestions. But the crash occurs when I first create the project and build it without adding in any code. I just uncomment the “quit” statement at the bottom which is already provided. I’ll build and run the application and it will start, but when I drop a file on it, it’ll crash on “quit”. Since this has happened on 2 different installations of Xcode on 2 different computers I would assume that it’s not a problem with the installation. Now, with the quit commented out, the application stays open and doesn’t crash. I’m wondering if there is another call or command that will quit the application…

Paul

I haven’t heard of anyone else reporting this. Quit has been around “a while” so I’m not sure what to think about the troubles your having. There are other ways of quitting or killing a process, but I’d look into the real reason for the problem before trying them. I think apple adds in the default quit command to let you know it’s there, but probably expects something else to go in there besides just the quit statement.

Perhaps if you put your quit command within some other code block…

set BrainFart to false

if BrainFart is false then
  quit
end if

Or attach it to a button/menu item via a scripted connection and see if it still get’s crazy.

on clicked theObject
  if name of theObject is "PleaseDontCrash" then
    quit
  end if
end clicked

Either of the above would tell you if having the quit command by itself in the handler is your problem. I have had a few mainstream apps give me a “Whatever app has unexpectedly quit…” error after quitting them, so it may just be a bug that is not a high priority fix for apple. What it really comes down to is two things…

  1. Is your app doing it’s job, and then crashing on quit… OR… is it NOT doing it’s job and crashing?

  2. (Assuming your other code is good) is it the app’s coded quit command that’s causing the crash… OR… is the finder reporting a crash that is not really real?

Try doing a quit both through a cocoa connection and via script code to see if it’s a problem with ANY quit or just a scripted quit command. Then see if the problem can be eliminated by placing it within another block of code, rather than just sitting by itself in the open handler. It seems trivial and illogical… but applescript can be that way. :rolleyes:

Cheers…
j

This crash is caused by a bug in the “on open” handler of ASStudio apps. Apple is aware of it and it’s supposed to be fixed in the next “release”.

A workaround is to simply add “return true” to the code in the very last line:

on open file_
–do some stuff
return true
end open

Hope this helps…

P.S.
If you do droplets quite often, you might as well edit the template file that’s used to base them off of to save yourself time in the future:
Just open and add the “return true” line to the project in the following folder:
/Library/Application Support/Apple/Developer Tools/Project Templates/Application/AppleScript Droplet/