/Developer/Examples/AppleScript Studio/Simple Toolbar is crashing!!!

I’m trying to programmatically build a toolbar for my application so I found the subject example project and followed it’s example to construct my toolbar. There’s one big problem with it… it keeps crashing when I remove items from the toolbar and then quit the application. Here’s what shows up in the terminal:

objc[2034]: FREED(id): message release sent to freed object=0x5b2eac0

So I figured I must have done something wrong when following the example. So I built and checked the example project and it does the same thing, it crashes when you remove toolbar items and then try to quit the application!


  1. do you see the same behavior when you build “Simple Toolbar” example project?
  2. how do I stop it from crashing?

I’m using 10.5.4, xcode 3, dual 2 ghz g5.

Yes. (Mac OS X 10.5.4, Xcode 3.1, Intel)

Thank you for confirming the problem Bruce. At least I know it’s not something I’m doing.

Now we need to find a fix! Any ideas? I understand the error message but the applescript code doesn’t do any releasing of objects so I can’t think how to fix it… unless somehow there’s a [retain] statement that could be used.

The only way I can think to stop the crashing is to disable the ability to customize the toolbar… which stinks! This line disables it:

call method “setAllowsUserCustomization:” of mainToolBar with parameter no

I figured out 2 ways to prevent the crashing, but both have their limitations, but at least something works…

  1. disable the ability to customize to toolbar totally so that you can’t remove buttons. You can do that with this code:
    call method “setAllowsUserCustomization:” of mainToolBar with parameter no

  2. disconnect the handler “update toolbar item theObject”. This handler is connected to the toolbar’s window in IB. When this handler doesn’t get called the crashing goes away. In the example project all this handler does is ‘return true’ which enables the buttons, so it must be something about having an enabled button which is not currently on the toolbar which causes the crash at quit.

For my project I can live without this handler so for now this solution is satisfactory for me.