title: How to implement a Cocoa-based Adobe Photoshop plugin
body: <p>Cocoa used to work on CS3 with the <a href="http://furbo.org/2008/07/08/plug-ins-the-cocoa-way/" rel="nofollow noreferrer">trick of putting a Cocoa bundle inside the main Carbon plugin bundle</a>, loading it from Carbon and issuing a NSApplicationLoad(). That's because Photoshop CS3 was Carbon-only and used to unload the plugin bundles. </p>
  
  <p>Photoshop CS4 uses Cocoa and has its own NSAutorelease pool in place on the main thread. </p>
  
  <p>On Photoshop CS4 very simple window-based xibs/nibs loaded by a NSWindowController work out of the box.</p>
  
  <p>But just add a binding to a control on the window and you'll get funny crashes, optionally when you close the window, or the second time you use the plugin, or even when closing Photoshop itself.</p>
  
  <p>Why everything seem to work well until I use some advanced Cocoa features? I'm stuck.</p>
  
  <p><strong>EDIT</strong>: I've really found myself the solution to the broader problem "How to use Cocoa in a Photoshop CS3/CS4 plugin?". See below.</p>