Make sure your C function calls NSApplicationLoad() this is needed to initialize Cocoa (including Cocoa runloops) from Carbon. Also make sure you setup your autorelease pool in you plug-in's main entry function.

The plug-in I wrote had all objective C except the startup code.

Scott Andrew

On Jun 10, 2009, at 7:07 AM, Frederik Slijkerman wrote:

Hi all,

I'm trying to make a Photoshop plugin with a Cocoa user interface, but I'm running into a persistent problem: after closing the plugin window, Photoshop crashes 90% of the time with the following call stack:

#0      0xa04590d8 in _XHNDL_trapback_instruction
#1      0xbf800fac in ??
#2      0x917ea9a2 in __CFRunLoopDoObservers
#3      0x917ebcfc in CFRunLoopRunSpecific
#4      0x917eccd8 in CFRunLoopRunInMode
#5      0x969f42c0 in RunCurrentEventLoopInMode
#6      0x96aa7904 in GetNextEventMatchingMask
#7      0x96aa7766 in WNEInternal
#8      0x96aa76c5 in WaitNextEvent

I've tried every suggestion I could find. The main plugin is a Carbon bundle that locates the Cocoa bundle that actually contains the core plugin as suggested here:
http://furbo.org/2008/07/08/plug-ins-the-cocoa-way/

The Cocoa bundle exports a plugin entry point as a C function. The Carbon bundle calls this from its own entry point using CFBundleCreate / CFBundleGetFunctionPointerForName, but it never releases the Cocoa bundle since apparently Cocoa bundles should not be unloaded. The whole idea behind this, as far as I can see, is that Photoshop unloads the Carbon bundle, but does not unload the core Cocoa bundle.

Next, the Cocoa bundle calls NSApplicationLoad, displays an empty window using [NSApp runModalForWindow], then closes the window and returns. At this point, I get the aforementioned crash.

What am I doing wrong? Any pointers would be highly appreciated -- I've been staring at this for about three days now...

Best regards,
Frederik Slijkerman
_______________________________________________

Cocoa-dev mailing list ([email protected])

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/scottandrew%40roadrunner.com

This email sent to [email protected]

_______________________________________________

Cocoa-dev mailing list ([email protected])

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to