[aus.mac] cdev resources

charles@tasis.utas.oz (Charles Lakos) (06/19/89)

I have been writing a cdev which controls a DRVR.  The DRVR and the data
which constitutes its parameters are loaded into the system heap, since it
must survive application entry and exit.  The cdev has a custom scroll bar
defined in a CDEF resource.

My problem relates to the closing of the cdev, when the machine will
occasionally bomb with a corrupted system heap AFTER the cdev and the
CDEF have handled their close requests.  

I have run out of ideas on how to debug this.  I have double checked all
my heap manipulation (which is not all that extensive), and I have even
removed all my dispose requests, all to no avail.  The fact that the 
problem is intermittent makes life even more difficult.

At the moment, my suspicions lie with the way the Control Panel cleans up
after a cdev is finished.  Does anyone have more information on that?
Below are some more specific questions.

1. Firstly, if I click on the close box of the Control Panel, the cdev 
   receives a close request before the CDEF, whereas if I click on another
   cdev in the list, the CDEF receives a close request before the cdev.
   Why the difference?
   
2. What happens if you cannot allocate resource numbers for the cdev
   code resources in the recommended range (-4048..-4033?)?  The CDEF
   does not have a number in that range because I couldn't work out how
   to reference the CDEF in the CNTL's procID (which should be the resource
   id of the CDEF * 16 + variation - all in 16 bits!).

3. Why is it that the system does not seem to use custom scroll bars in its
   cdevs??  Instead those cdevs (e.g. Sound) specify a UserItem where the
   scroll bar will be drawn.  Makes one suspicious!

Any suggestions welcome.

Charles Lakos.

ACSnet: charles@tasis.utas.oz
ARPA:   charles%tasis.utas.oz@uunet.uu.net
UUCP:   {enea,hplabs,mcvax,uunet,ukc}!munnari!tasis.utas.oz!charles
Snail:  Computer Science Dept., University of Tasmania,
	GPO Box 252C, Hobart, TAS, 7001, Australia.