Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!husc6!cs.utexas.edu!oakhill!tomj
From: tomj@oakhill.UUCP (Tom Johnson)
Newsgroups: comp.sys.mac.programmer
Subject: Re: Dialogs in INITS (LSC3)
Summary: Check your stack for trashed values
Keywords: ModalDialog behavior
Message-ID: <1517@oakhill.UUCP>
Date: 22 Sep 88 18:49:43 GMT
References: <1331UD040164@NDSUVM1>
Reply-To: tomj@oakhill.UUCP (Tom Johnson)
Organization: Motorola Inc., Austin Tx.
Lines: 38

In article <1331UD040164@NDSUVM1> UD040164@NDSUVM1.BITNET (a.d. jensen) writes:
>Well, I got a slug of ideas as to what might be changed, here are the
>results:
>...
>In review, nobody really addressed the quesion of why the DisposDialog
>crashes when any other reference to theDialog caused no problems.
>
>dale

I haven't been keeping up with this news group for a while, and so this
posting may be old news...if it is, you can skip this prior to flaming on...

I have recently been having REAL difficulties trying to display a modal
dialog in an RDEV I've been working on.  I found that if I let the system
create the dialog storage on _GetNewDialog, then the dialog gets created
o.k. (but doesn't if I reserve the storage for it!!!???).  Later, when I
call _ModalDialog, (I didn't mention that all of this is from assembly language
did I...) the dialog static text gets displayed as usual.  When the user
quits the dialog, a look at the stackframe (my "A6" world), it is completly
trashed.  One of the values that is trashed happens to be the DialogHandle
returned by the original call to _GetNewDialog.  Thus, when I try to call
_DisposDialog, passing the (now corrupted) handle, BUS ERROR.

The work-around?---I use an alert instead of a dialog!!!  This is fascinating
to me because Alert calls ModalDialog!!

Anyone want to take a stab at this one?  I have checked this code
VERY VERY VERY carefully.  The _GetNewDialog call completes properly and
returns the correct handle.  Everything is O.K. on the stack prior to the
_ModalDialog call, but trashed on return. (p.s. I also had another Mac
assembly language weenie check this out.  He is also baffled.  All we can
come up with is that this is an undocumented "feature" of programming
RDEV's...I've already found a few more...

|Standard Disclaimer
|Tom Johnson, Hi-End MPU Marketing
|Motorola, Inc.
|tomj@oakhill.UUCP