[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Disposing appleevents
- To: info-mcl
- Subject: Re: Disposing appleevents
- From: email@example.com
- Date: Mon, 2 Mar 1992 11:31:51 -0500
>Does lisp's garbage collection facility take care of appleevent descriptor
>records? The code that I have looked at does dispose them sometimes, and
>sometimes it doesn't. which is correct?
I don't believe that garbage collection ever takes care of appleevent
descriptor records for you, but stack allocation and clever macros can
There are two things to be concerned about with appleevent descriptor
1) The "public" part - the :aedesc which is allocated by rlet or
make-record. If you create the :aedesc with make-record, you
call dispose-record some day.
2) The "private" part, which is allocated by the Apple Event
stored in the :aedesc record). #_aedisposedesc should be called
are done with a discriptor.
Note that when you SEND an AppleEvent, you need to create at least two
descriptor records, but when you RECEIVE an AppleEvent, two descriptor
records are passed as parameters, and are not your responsibility
(AppleEvents will dipsose of them for you).
Now the WITH-AEDESCS macro (which seems to be un-documented but is very
useful) handles most of the work of allocting and disposing both the public
and private parts of an AppleEvent.
(with-aedescs (event reply target)
(create-oapp event target)
(send-appleevent event reply :reply-mode :no-reply))
(RLET ((EVENT :AEDESC :DATAHANDLE (%NULL-PTR))
(REPLY :AEDESC :DATAHANDLE (%NULL-PTR))
(TARGET :AEDESC :DATAHANDLE (%NULL-PTR)))
(CREATE-OAPP EVENT TARGET)
(SEND-APPLEEVENT EVENT REPLY :REPLY-MODE :NO-REPLY))
(UNLESS (%NULL-PTR-P (RREF EVENT AEDESC.DATAHANDLE))
(REQUIRE-TRAP TRAPS:_AEDISPOSEDESC EVENT))
(UNLESS (%NULL-PTR-P (RREF REPLY AEDESC.DATAHANDLE))
(REQUIRE-TRAP TRAPS:_AEDISPOSEDESC REPLY))
(UNLESS (%NULL-PTR-P (RREF TARGET AEDESC.DATAHANDLE))
(REQUIRE-TRAP TRAPS:_AEDISPOSEDESC TARGET))))
Derek White (-ex Mr. Pascal)
ATG/East (AppleLink: DEREK)