• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Problem with stopModalWithCode on a different thread
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Problem with stopModalWithCode on a different thread


  • Subject: Problem with stopModalWithCode on a different thread
  • From: Bill Appleton <email@hidden>
  • Date: Mon, 21 Jun 2010 11:09:01 -0700

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?



Thanks in advance,

Bill
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Problem with stopModalWithCode on a different thread
      • From: Corbin Dunn <email@hidden>
    • Re: Problem with stopModalWithCode on a different thread
      • From: Jens Alfke <email@hidden>
  • Prev by Date: chaining animations
  • Next by Date: Re: docs, KVO and NSUserDefaults etc.
  • Previous by thread: chaining animations
  • Next by thread: Re: Problem with stopModalWithCode on a different thread
  • Index(es):
    • Date
    • Thread