[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Structure field concatenation

David Fanning wrote:
> All you have to do is remember to clean this pointer up
> in some kind of cleanup routine

I have been using the following cleanup routine. The only downside is
that it does not clean up nested heap variables.

; Universal cleanup routine. Kills everything it finds,
; but will miss nested pointers or ORefs.

pro PARgrDisplay::cleanup
compile_opt IDL2, OBSOLETE
;Release all pointers and object references.
tags = n_tags({PARgrDisplay})
for i=0, tags-1 do if size(self.(i), /type) eq 10 $
	then ptr_free, self.(i)
for i=0, tags-1 do if size(self.(i), /type) eq 11 $
	then obj_destroy, self.(i)