🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.mac
Article #15297

Possible Bug in Chernicoff Program?

#15297
From: frankng
Date: Fri, 27 Mar 1987 14:45
46 lines
2165 bytes
I was looking through the sample program *MiniEdit* discussed in
Stephen Chernicoff's book *Macintosh Revealed Vol II* when I stumbled
across what I think maybe a bug, please correct me if I'm wrong.

It involves the interaction between the procedure *CloseAppWindow* and
the procedure *DoActivate*:

In *CloseAppWindow*, TEDispose is called to dispose of the program
window's edit record, which is part of a structure whose handle is the
window's reference constant.

Then HideWindow is called to force a deactivate event, upon which
Chernicoff's Activate/Deactivate event handler is invoked:

	TEDispose(editRec);
	...
	HideWindow(TheWindow);	/*	force deactivate event	*/
	if GetNextEvent(ActivateEvt, TheEvent) then
		DoActivate;					/*	handle deactivate event	*/
	if GetNextEvent(ActivateEvt, TheEvent) then
		DoActivate;					/*	handle activate event	*/

However, in *DoActivate*, if the event is a deactivate event, the
window's edit record is deactivated:

	if BitAnd(modifiers, ActiveFlag) <> 0 then
		/* handle activate event	*/
	else begin
		/*	handle deactivate event	*/
		...
		TEDeactivate(editRec);
		...
	end;

Will this not bomb, since the program is referencing (trying to
deactivate) a nonexistent (NULL?) edit record in TEDeactivate?

Also, aren't the parameters to GetNextEvent incorrect? Shouldn't the
first parameter be ActivMask instead of ActivateEvt?

thanks in advance for any help
-- 
Frank Ng			ACSnet:	frankng@basser.oz
Department of Computer Science	ARPA:	frankng%basser.oz@seismo.css.gov
University of Sydney NSW 2006	UUCP:	seismo!munnari!basser.oz!frankng
AUSTRALIA
Technical Details
Message-ID: <897@basser.oz>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watnot!watmath!clyde!rutgers!seismo!munnari!basser!frankng

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watnot!watmath!clyde!rutgers!seismo!munnari!basser!frankng
From: frankng@basser.UUCP
Newsgroups: comp.sys.mac
Subject: Possible Bug in Chernicoff Program?
Message-ID: <897@basser.oz>
Date: Fri, 27-Mar-87 09:45:45 EST
Article-I.D.: basser.897
Posted: Fri Mar 27 09:45:45 1987
Date-Received: Sun, 29-Mar-87 08:45:56 EST
Organization: Dept. of Comp. Science, Uni of Sydney, Australia
Lines: 46
Keywords: possible bug, empty records