[racket] instantiating multiple sandboxes with gui's

From: Robby Findler (robby at eecs.northwestern.edu)
Date: Thu Apr 3 17:49:12 EDT 2014

I think the main missing thing is that the thread you're requiriing the
user's program on should be under the control of the custodian. In other
words, you'll want to create a new eventspace (under the new custodian) and
queue a callback over to it to require the user's program.

Robby


On Thu, Apr 3, 2014 at 4:26 PM, Greg Hendershott
<greghendershott at gmail.com>wrote:

> So the background for Spencer's question was a problem with my Emacs
> racket-mode when using racket/gui/base.
>
> There's a long-ish bug report comment thread. If you want to read it,
> at all, you might want to skip to the last few comments, here:
>
>
> https://github.com/greghendershott/racket-mode/issues/26#issuecomment-39494285
>
> Or the TL;DR: I probably don't need racket/sandbox at all. I probably
> just need a new namespace and a custodian -- in order to do a
> DrRacket-style "reset the REPL to the source file".
>
> Matthew and Robby I know you're both incredibly busy, but if either of
> you had a chance to look at this code, I'd be grateful. Although part
> of me hopes you'll say "perfect!", the older/wiser part of me hopes
> you'll point out X Y and Z problems I don't yet realize I have. It's
> just these 30 lines of code here:
>
>
> https://github.com/greghendershott/racket-mode/blob/experimental/sandbox.rkt#L30-L66
>
> On Sun, Mar 23, 2014 at 8:35 PM, Robby Findler
> <robby at eecs.northwestern.edu> wrote:
> > It is safe, however, to share the racket/gui/base that you get with the
> one
> > in the sandbox.
> >
> > Robby
> >
> >
> > On Sun, Mar 23, 2014 at 7:25 PM, Matthew Flatt <mflatt at cs.utah.edu>
> wrote:
> >>
> >> Yes, this is a limitation of `racket/gui/base`. On initialization, the
> >> library must register in various non-composable ways with an underlying
> >> GUI toolkit (callbacks, Objective-C classes, Win32 classes, etc.), and
> >> so `racket/gui/base` cannot be instantiated multiple times.
> >>
> >> At Sun, 23 Mar 2014 20:12:43 -0400, Spencer Florence wrote:
> >> > I'm attempting to launch multiple evaluators which require
> `racket/gui`,
> >> > however I get the error:
> >> >
> >> > cannot instantiate `racket/gui/base` a second time in the same process
> >> >
> >> > Is `racket/gui/base` maintaining some kind of state thats escaping the
> >> > sandbox?
> >> >
> >> >
> >> >
> >> >
> >> >
> >> > Example of the problem:
> >> >
> >> > #lang racket/base
> >> > (require racket/sandbox)
> >> >
> >> > (call-with-trusted-sandbox-configuration
> >> >  (lambda ()
> >> >    (define (make)
> >> >      (make-evaluator 'racket/base
> >> >                      #:requires '(racket/gui/base)))
> >> >
> >> >    (make)
> >> >    (make)))
> >> > ____________________
> >> >   Racket Users list:
> >> >   http://lists.racket-lang.org/users
> >> ____________________
> >>   Racket Users list:
> >>   http://lists.racket-lang.org/users
> >
> >
> >
> > ____________________
> >   Racket Users list:
> >   http://lists.racket-lang.org/users
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20140403/67642f02/attachment-0001.html>

Posted on the users mailing list.