perry@madnix.UUCP (Perry Kivolowitz) (02/01/90)
I Received The Following Today:
==========================
amiga.dev/main #10513, from bdawson, 2165 chars, Tue Jan 30 03:48:03 1990
--------------------------
TITLE: GOMF bug
A problem was reported a few weeks ago about CygnusEd, or more
specifically the freely distributable req.library that CygnusEd uses,
tromping on location $78 when bringing up the file requester. There was
some suspicion at the time that this was actually caused by GOMF3.0 rather
than req.library, since it only happened with GOMF present.
This suspicion has now been confirmed. GOMF3.0 has a bug in it
where GOMF itself will tromp on location $78 if a call to OpenWindow fails.
GOMF then reports that somebody has tromped on location $78, not realizing
that it is telling on itself.
The problem occurs because GOMF does a SetFunction on OpenWindow.
It does this so that it can write the task pointer of the task opening the
window into the wb_ExtData and wb_UserData fields of the Window structure.
This allows it to implement resource tracking, of windows anyway.
Unfortunately, it doesn't check for failure of the OpenWindow call. Below,
for those who are interested in such things, is the code in question.
Although the problem is with GOMF, future versions of req.library
(due to be distributed on networks and with CygnusEd very soon) will have a
check to almost completely eliminate the problem, by not calling OpenWindow
if it can be told that calling it would probably fail.
Here's the code (from GOMF), disassembled by following the new
OpenWindow vector:
SetFunctionedOpenWindow
BSR.L FindCurrentTask
MOVE.L A2,-(SP)
MOVEA.L OldOpenWindow,A2
JSR (A2) ;Call the old open window function.
;Notice it does not check to see
;if OldOpenWindow failed!!! It simply
;starts using the value returned in
;D0!!!
EXG D0,A2 ;A2 could be getting ZERO!!!
MOVE TaskPointer,$78(A2) ;wd_UserData - BING BING BING
MOVE.L $74(A2),D0
BNE.L SkipExtDataLoad
MOVE.L TaskPointer,$74(A2) ;wd_ExtData
SkipExtDataLoad
EXG D0,A2
MOVEA.L (SP),A2
RTS
FindCurrentTask
MOVEM.L D0/A1/A6,-(SP)
MOVEA.L #0,A1
MOVEQ #0,D0
MOVEA.L ExecBaseCopy,A6
JSR _LVOFindTask(A6)
MOVE.L D0,TaskPointer ; My, this doesn't look very
; Re-entrant.
MOVEM.L (SP)+,D0/A1/A6
RTS
--------------------------------------------------------------------------
Thank you to all who gave us clues. We found the problem. The author of
GOMF has been notified. Please spread this message around far and wide so
that people will not mistakenly believe CEDPro is the cause.
--
Perry Kivolowitz, ASDG Inc. ``We look for things. Things that make us go.''
UUCP: {harvard|rutgers|ucbvax}!uwvax!astroatc!nicmad!madnix!perry
CIS: 76004,1765 PLINK: pk-asdg