• 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
Re: [NSApp stop:]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [NSApp stop:]


  • Subject: Re: [NSApp stop:]
  • From: Jason Coco <email@hidden>
  • Date: Thu, 9 Oct 2008 14:10:11 -0400


On Oct 9, 2008, at 09:15 , Michiel de Hoon wrote:

Hi everybody,

According to the documentation, [NSApp stop:] will break the flow of control out of the [NSApp run] method. While this is true, [NSApp run] doesn't notice that [NSApp stop:] was called until some other event comes along. So I call [NSApp stop:], nothing happens, and when I then move the mouse over one of the application windows [NSApp run] exits. Currently my workaround is to post a do-nothing event to NSApp to wake up the runloop:

   [NSApp stop: nil];
   NSEvent* event = [NSEvent otherEventWithType: NSApplicationDefined
                                       location: NSMakePoint(0,0)
                                  modifierFlags: 0
                                      timestamp: 0.0
                                   windowNumber: 0
                                        context: nil
                                        subtype: 0
                                          data1: 0
                                          data2: 0];
   [NSApp postEvent: event atStart: true];

Then [NSApp run] exits immediately.
But there must be a better way to do this. Does anybody know what the right way is to do this?

Submit a bug report and use a CFRunLoop for now :)

Jason

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

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: [NSApp stop:]
      • From: Michiel de Hoon <email@hidden>
References: 
 >[NSApp stop:] (From: Michiel de Hoon <email@hidden>)

  • Prev by Date: Re: "Drawing" CATextLayer into a CGImageRef?
  • Next by Date: Re: How can be my application notified about user defaults changes?
  • Previous by thread: [NSApp stop:]
  • Next by thread: Re: [NSApp stop:]
  • Index(es):
    • Date
    • Thread