[racket] Notification when window is closed

From: Robby Findler (robby at eecs.northwestern.edu)
Date: Sun Aug 5 09:27:30 EDT 2012

My first guess is that the right way to do this is to use custodians
to do this shutdown, not closing the window (and perhaps make closing
the window shutdown the custodian, depending). Generally speaking,
custodians are the abstraction that Racket uses to manage the clean
shutdown of external state (like network connections, open files, open
windows, etc).

Alternatively, if it makes sense, you could do this shutdown only when
the app exits (so the low-level connection you make to the DLL would
have to be sensitive to who is connecting to it). This is how racket
connects to the underlying operating system's GUI toolkit, as that
should not be shutdown each time a custodian is shutdown.

Robby

On Sun, Aug 5, 2012 at 8:22 AM, Antonio Menezes Leitao
<antonio.menezes.leitao at ist.utl.pt> wrote:
> On Sun, Aug 5, 2012 at 1:33 PM, Robby Findler
> <robby at eecs.northwestern.edu> wrote:
>> No, this second call to Run does the equivalent of 'force quit' on the
>> previous program, which is what closes the old windows. Technically,
>> it is calling custodian-shutdown-all on a custodian that controls all
>> things the previous run created.
>>
>> Is there some external state that isn't getting cleaned up?
>
> Yes. I'm using a DLL and I need  to call a (kind of) shutdown
> function when the window is closed, either because the user
> clicked the close button or because he clicked the Run button
> again.

Posted on the users mailing list.