It's been a few years since I last looked at this. If I remember
correctly, the problem is a mismatch between the `racket/gui` model of
eventspaces and the way that shutdown notifications and responses work
in Cocoa. The mismatch makes it difficult for `racket/gui` to defer its
answer to the OS while performing further GUI activity that might
involve events and/or threads.

The `applicationShouldTerminate:` handler is in

 gui-lib/mred/private/wx/cocoa/queue.rkt

While it may appear that returning `NSTerminateLater` is the solution,
I think that would leave Cocoa still driving the event loop, which
locks out Racket from changing threads (because it's not safe to change
Racket threads while Cocoa is on he stack), and so on.

In short, I don't know how to make it work better right now, but it's
possible that someone else could make progress here.

At Mon, 18 May 2015 17:15:50 +0200, Michael Tiedtke wrote:
> When I try to shutdown my Mac Racket (run from the command line)
> cancels the shutdown or logout.
> 
> I can install an application-quit-handler (with racket/gui) like this:
> 
>     ;;
>     ;; Operating System Interface Incoming
>     (define (quit-request)
>       ;; XXX this is called but racket still cancels
>       ;; any shutdown, restart or logout
>       (debug-message "quit-request called")
>       (send main-frame show #f)
>       (exit)
>       #t)
>     (application-quit-handler quit-request)
> 
> On logout or shutdown the new handler is called, closes main-frame
> but Racket still does not exit and cancels the shutdown. It does exit
> when the only window main-frame is closed manually, when I choose
> a menu item with "exit" in its handler or when I choose the Quit menu
> item in the Mac Application menu.
> 
> There is an old bug report about this here:
> http://bugs.racket-lang.org/query/?cmd=view&pr=12252
> 
> Does anyone know how to make Racket behave better?
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email 
> to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to