comp.lang.idl-pvwave archive - RDF feed
type: channel
description: Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado
items: IDL_Container and garbage collection

IDL_Container and garbage collection
type: item
description: Hi, I've just found an interesting problem with migrating from IDL 7 to IDL 8. When an IDL_Container is cleaned up and then all of its children are automatically deleted. This means that the reference count hits zero and all children are also destroyed. Example code below: function obj_create_child oParent = obj_new('IDL_Container') oChild = obj_new('IDL_Container') oParent -> Add, oChild help, oChild ; Child Object has not been destroyed yet ;;;; oParent -> remove, /ALL ; Workaround - Remove all children before garbage collection ;;;; obj_destroy, oParent ;;; Pedantic - Destroy the empty heap object return, oChild end pro obj_create help, obj_create_child() ; Child object is destroyed before it is returned because oParent is garbage collected end In many ways the above snippet of code is sloppy because it would leave the parent object on heap. Code that performed correct garbage collection in IDL 7 should not be affected by this issue. Robbie
creator: Robbie
date: 2010-08-08T07:16:11-00:00