Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!cornell!uw-beaver!tektronix!sequent!mntgfx!tomc
From: tomc@mntgfx.mentor.com (Tom Carstensen)
Newsgroups: comp.sys.mac.programmer
Subject: Re: Bug in System 6.0, or is it ME?
Summary: Can you expect a Disposed Handle to be NULL ????
Message-ID: <1988Jul5.112217.267@mntgfx.mentor.com>
Date: 5 Jul 88 18:22:14 GMT
References: <1988Jun22.110349.325@mntgfx.mentor.com> <13112@apple.Apple.COM>
Organization: Mentor Graphics Corporation, Beaverton Oregon
Lines: 49

In article <13112@apple.Apple.COM>, tecot@Apple.COM (Ed Tecot) writes:
> In article <1988Jun22.110349.325@mntgfx.mentor.com> tomc@mntgfx.mentor.com (Tom Carstensen) writes:
> >I've been using MacNosy alot to do debugging, and every
> >once in a while I set the Trap Checksum/Disipline on
> >to more thoroughly check my program.
> >
> >Every since I started using System 6.0, the debugger always
> >breaks when exiting a Dialog (ie GetNewDialog - ModalDialog -
> >CloseDialog).  It complains on the entry to TEDispose, ( I
> >believe its disposing of its TERecord it used for the dialog) and
> >I look at the TERec, and it looks like it's trying to dispose
> >of something that already been disposed of (There are FFFD
> >in a lot of the field, with the debugger puts there after
> >a DisposHdl() & DisposPtr().  If I tell the debugger to 
> >continue on, It breaks at DisposHdl, and the hdl is a
> >bad ptr (bogus).  This is also preventing me from checking
> >the rest of my program, since it can never get past this point.
> 
> This is a problem with MacNosy discipline.  I spoke with Steve Jasik about it
> a few weeks ago.  The problem is that MacNosy's setting the pointer to FFFD
> fools the dialog manager into thinking it hasn't yet disposed it.  The code
> is something like:
> 
> 	if (hTE != NIL) TEDispose(hTE);
> 
> I recommend not using MacNosy discipline until Steve fixes this.
> 

I didn't thing you could expect that a Disposed of handle or pointer would
be NULL (or NIL) ???  Should Apples code go something like this:

    TEDispose(hTE);
    hTE = NULL;
    . . .
    . . .
    if (hTE != NULL) TEDispose(hTE);
    
MacNosy's feature of putting FFFD in Disposed of handles has been an
EXTREMELY USEFUL feature for flushing a LOT of bugs in my program.

:------------------------------------------------------------:
: Tom Carstensen         Usenet: tomc@mntgfx.MENTOR.COM      :
: Mentor Graphics                Delphi: CARSTENSEN          :
:                                GEnie:  CARSTENSEN          :
:                                                            :
:         If you are sick and tired, of all your dreadful    :
:         dimensions, let me stretch your TIME!              :
:                                       - Time Operator      :
:------------------------------------------------------------: