Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!usc!apple!sun-barr!newstop!sun!booga.Eng.Sun.COM!siegel From: siegel@booga.Eng.Sun.COM (Josh Siegel) Newsgroups: comp.windows.news Subject: Re: Hunh? (locked send contexts) Message-ID: <139221@sun.Eng.Sun.COM> Date: 19 Jul 90 21:23:53 GMT References: <9007161732.AA01251@> <1990Jul19.153846.1586@canon.co.uk> Sender: news@sun.Eng.Sun.COM Organization: Sun Microsystems, Mt. View, Ca. Lines: 57 In article <1990Jul19.153846.1586@canon.co.uk> laukee@canon.co.uk (David Lau-Kee) writes: >bice@hbo.UUCP (Brent A. Bice) writes: > >... >>entry I want to have a function that will spawn a completely independent >>window. When the main window gets Zap'd, it should go away, but not kill >>the window/s that it spawned. I have a piece of code that does this, but >>the main window won't die until all of the other window/s that it spawned >>also are zapped. Howcomeforwhy? Am I missin' somethin' here? Below is the code: /MainDict /ThisIsIt def % Make a window with a new processgroup and a clean environment. /makewin { { % Clean up dictionary stack { currentdict /MainDict known { exit } if end } loop clear % clean up regular stack newprocessgroup framebuffer /new LiteWindow send dup /reshapefromuser exch send /map exch send } fork pop } def % Here's the main window. It has a menu entry that merely calls makewin. framebuffer /new LiteWindow send dup { /ClientMenu [ (MAKEWIN) { makewin } ] /new DefaultMenu send def } exch send dup /reshapefromuser exch send /map exch send Problems, A send command locks the DictStack so that you cannot "end" your way into a class dictionary. Under NeWS 2.0, this generates a dict_underflow error. Under some other versions of NeWS, I think this fails silently (I don't remember which ones). The proper solution is to replace: { currentdict /MainDict known { exit } if end } loop with clearsendcontexts and get rid of the /MainDict noise. --josh