🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.micro.mac
Article #6964

TransSkel1.0 Bug (horrors!) + Fix

#6964
From: Paul DuBois
Date: Wed, 27 Aug 1986 22:02
100 lines
2964 bytes
There's a bug in the window growing code of TransSkel (DoGrow) - after
a window is grown, the entire port is invalidated, which causes an
update event to be generated for the window.  The host is then notified
that the window was resized.  Fortuitously, due to the way TransSkel
operates, the current port is virtually always set to the window that
is resized.  Under certain circumstances, however, it won't be, and a
bomb occurs.  The fix is to set the port before invalidating it.  This
also explains what (to me, anyway) was an otherwise inexplicable
phenomenon in DoActivate.

The patches to (a) correct DoGrow and (b) restore DoActivate to a
more aesthetic state follow.



In DoGrow, Change:
------------------

-	if (growRes)	/* non-zero if size change */
-	{
-		SizeWindow (thePort, LoWord (growRes), HiWord (growRes), false);
-		InvalRect (&thePort->portRect);	/* force update */
-		if (h != nil)
-			(**h).whSized = true;
-	}

To:
---

+	if (growRes)	/* non-zero if size change */
+	{
+		SizeWindow (thePort, LoWord (growRes), HiWord (growRes), false);
+		SetPort (thePort);
+		InvalRect (&thePort->portRect);	/* force update */
+		if (h != nil)
+			(**h).whSized = true;
+	}

Change:
-------

-/*
-	Pass activate/deactivate notification to handler.
-
-	Oddity:  if the handler has nil update and activate procs, then
-	if I say
-	
-		if ((h != nil) && ((p = (**h).whActivate) != nil))
-		{
-			SetPort ((**h).whWind);
-			(*p) (active);
-		}
-	
-	I get a bomb after growing the window.  Apparently the port must
-	be set EVEN IF the handler ignores activates.
-	???  I don't understand why this should be.
-*/
-
-static DoActivate (h, active)
-WHandler	**h;
-Boolean		active;
-
-{
-ProcPtr	p;
-
-	if (h != nil)
-	{
-		SetPort ((**h).whWind);
-		if ((p = (**h).whActivate) != nil)
-			(*p) (active);
-	}
-}

To:
---

+/*
+	Pass activate/deactivate notification to handler.
+*/
+
+static DoActivate (h, active)
+WHandler	**h;
+Boolean		active;
+
+{
+ProcPtr	p;
+
+	if ((h != nil) && ((p = (**h).whActivate) != nil))
+	{
+		SetPort ((**h).whWind);
+		(*p) (active);
+	}
+}
-- 
Paul DuBois     UUCP: {allegra,ihnp4,seismo}!uwvax!uwmacc!dubois    |
                ARPA: dubois@easter                               --+--
                                                                    |
Begin at my sanctuary...                                            |
                          Ezekiel 9:6
Technical Details
Message-ID: <212@uwmacc.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!uwvax!uwmacc!dubois

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!uwvax!uwmacc!dubois
From: dubois@uwmacc.UUCP (Paul DuBois)
Newsgroups: net.micro.mac
Subject: TransSkel1.0 Bug (horrors!) + Fix
Message-ID: <212@uwmacc.UUCP>
Date: Wed, 27-Aug-86 18:02:21 EDT
Article-I.D.: uwmacc.212
Posted: Wed Aug 27 18:02:21 1986
Date-Received: Wed, 27-Aug-86 21:26:39 EDT
Distribution: net
Organization: UW-Madison Primate Center
Lines: 100