On Jun 21, 2010, at 11:09 AM, Bill Appleton wrote:

> Hi All,
> 
> In 64 bit Safari our NPAPI plugin needs to use a few system dialogs for
> opening files, printing, etc.
> 
> These system dialogs call stopModalWithCode to deliver the result of the
> dialog interaction back to the runModalForWindow function
> 
> But the stopModalWithCode function does not work on another thread, as the
> NSApplication documentation makes clear:
> 
> *For example, use abortModal when running in a different thread from the
> Application Kit’s main thread*
> 
> When running on a different thread like this runModalForWindow will always
> return zero no matter what is passed to stopModalWithCode
> 
> We were easily able to fix this problem in our other dialogs by just saving
> the button clicked in a global and calling abortModal
> 
> Can anyone think of a way to fix this for the system dialogs? It seems like
> a trivial problem but I can't think of the best way to fix it
> 
> 1) Can anyone explain in more detail what is going on and why?
> 
> 2) Could we sub class stopModalWithCode and fix it there?
> 
> 3) Can anyone explain how calls to NSApp still work when a child process has
> been created?
> 
> 4) Maybe I should subclass NSOpenPanel etc. and try to fix it there?

I'm not familiar with plugin creation in Safari, but I can tell you that the 
NSSavePanel and NSOpenPanel should not be run on a background thread. You will 
eventually get crashes; they are not threadsafe.

corbin


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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 arch...@mail-archive.com

Reply via email to