[comp.sys.mac.programmer] Bug in SysBeep?

cruff@ncar.ucar.edu (Craig Ruff) (09/05/88)

I think I have found a bug in SysBeep.  Setup:

	Mac+
	System 4.2
	Volume = 0 (off)

After a call to SysBeep, thePort->txFont field is set back to 0!

The following code illustrates this:

	EraseRect(&thePort->portRect);
	MoveTo(30, 40);
	TextFont(4);
	TextSize(9);
	DrawText("Before", 0, 6);
	SysBeep(3);
	MoveTo(30, 60);
	DrawText("After", 0, 5);

The "Before" string is drawn in Monaco font.  The "After" string is drawn
in System font (Chicago).  Tracking down the bug with a debugger,
thePort->txFont is changed sometime during the trap to SysBeep.

Note that this bug does not occur if the volume > 0;
-- 
Craig Ruff      NCAR                         INTERNET: cruff@ncar.UCAR.EDU
(303) 497-1211  P.O. Box 3000                   CSNET: cruff@ncar.CSNET
		Boulder, CO  80307               UUCP: cruff@ncar.UUCP
-- 
Craig Ruff      NCAR                         INTERNET: cruff@ncar.UCAR.EDU
(303) 497-1211  P.O. Box 3000                   CSNET: cruff@ncar.CSNET
		Boulder, CO  80307               UUCP: cruff@ncar.UUCP

lippin@jell-o.berkeley.edu (The Apathist) (09/05/88)

Recently cruff@ncar.UCAR.EDU (Craig Ruff) wrote:
>I think I have found a bug in SysBeep.  Setup:
>
>	Mac+
>	System 4.2
>	Volume = 0 (off)
>
>After a call to SysBeep, thePort->txFont field is set back to 0!

Is thePort the window manager port?  SysBeep with the volume set to
zero should call FlashMenuBar, which could change the font of the
window manager port, as is its priviledge.  You're the one who
shouldn't be mucking about in that port.

					--Tom Lippincott
					..ucbvax!math!lippin

		"Foo, you are nothing but a charlatan!"
					--Adventure

cruff@ncar.ucar.edu (Craig Ruff) (09/05/88)

In article <13898@agate.BERKELEY.EDU> lippin@math.berkeley.edu writes:
>Recently cruff@ncar.UCAR.EDU (Craig Ruff) wrote:
>>I think I have found a bug in SysBeep.  Setup:
>
>Is thePort the window manager port?

Thanks for the info.  I hadn't thought about which port was being used.
The software that is mucking with the window manager's port is the
Aztec C console driver, which doesn't get a new window before doing
so.  I can fix it so it does something reasonable now.
-- 
Craig Ruff      NCAR                         INTERNET: cruff@ncar.UCAR.EDU
(303) 497-1211  P.O. Box 3000                   CSNET: cruff@ncar.CSNET
		Boulder, CO  80307               UUCP: cruff@ncar.UUCP