Article 14004 of comp.sys.newton.programmer:
Path: hustle.rahul.net!rahul.net!a2i!bug.rahul.net!rahul.net!a2i!samba.rahul.net!rahul.net!a2i!news.PBI.net!news.mathworks.com!nntp.primenet.com!news1.best.com!nntp1.best.com!usenet
From: "Walter Smith" <wrs@pobox.com>
Newsgroups: comp.sys.newton.programmer
Subject: Re: error 77
Date: Tue, 16 Jul 1996 15:08:58 -0700
Organization: Best Internet Communications
Lines: 35
Message-ID: <01bb7364.6e34d2a0$520456ce@wsmith.microsoft.com>
References: <31EBDC8B.41C6@sluvca.slu.edu>
NNTP-Posting-Host: wsmith.vip.best.com
X-Newsreader: Microsoft Internet News 4.70.1080

> evt.ex.abt.bus
> 	77

Newton programming folklore alert: That means you left a pointer into your
package in the system when your package was removed. Often, when that
happens, you get a comprehensible error to that effect, but there's one
place in the system (namely, searching a frame for a slot name) where we
couldn't afford the test, so you get an unfriendly error.

> routing.(kAppSymbol):=partFrame.theForm.myRoutingFrame;

You're leaving a reference to a symbol (kAppSymbol) from your package in
the "routing" frame. When your package is removed, references to objects
in your package are changed to the <bad package ref> value (whose decimal
representation is, not coincidentally, 77). Anybody who looks at the
routing frame thereafter and happens to run across the slot with <bad
package ref> as the tag will get a bus error.

> and the remove script is:
> RemoveSlot(routing, 'kAppSymbol);

This code is a good example of something that will search the routing
frame and run into the <bad package ref>! (Also, aside from that, I don't
think you meant to quote kAppSymbol.)

The answer is simple--don't put a reference to your package in the routing
frame. Internalize the symbol instead, so the routing frame has a
reference to a symbol that won't go away when your package does:

routing.(EnsureInternal(kAppSymbol)):=partFrame.theForm.myRoutingFrame;

- W
-- 
Walter Smith    wrs@pobox.com    http://www.pobox.com/~wrs/



