comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: object reference destroy
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: object reference destroy [message #67105 is a reply to message #67103] Mon, 22 June 2009 05:40 Go to previous messageGo to previous message
greg.addr is currently offline  greg.addr
Messages: 160
Registered: May 2007
Senior Member
;put a cake into the container
container = obj_new('IDLtin')
cake = obj_new('IDLcake')
container->add, cake

;get the cake out for the first time
objref_1= container->get(/all)
....

;eat the cake for the first time. (hunger reason)
obj_eat, objref_1

;need to get the cake out from the container second time
objref_2= container->get(/all)

;but objref_2 is not a cake, because i ate it in the previous
section.
IDL> print, obj_valid(objref_2)
0

On Jun 22, 11:53 am, crane <dos...@163.com> wrote:
> hi, people
>
> I have a container to hold a object, and I need to use this object
> often. In order to avoid memory leakage, i have to destroy the object
> reference after use. But once i destroy the object reference, the
> object in the container is also destroy, because they are pointing to
> the same object. For example:
>
> ; put a object into the container
> container = obj_new('idl_container')
> obj = obj_new('myclass')
> container->add, obj
>
> ; get the object for the first time
> objref _1= container->get(/all)
> ....
> ;  destroy the object reference for the first time. (memory reason)
> obj_destroy, objref_1
>
> ; need to get the object from the container second time
> objref_2= container->get(/all)
> ; but objref_2 is not a valid object anymore, because i destroy the
> object in the previous section.
> IDL> print, obj_valid(objref_2)
> 0
>
> I like to use container to hold object, it is convenience to play with
> objects.  can somebody help me through this problem or have another
> idea for alternative. thanks.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: IDL 7.1.1 Workbench update for Macintosh OS X
Next Topic: Re: AT&T Usenet Netnews Service Shutting Down

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 04:03:42 PDT 2025

Total time taken to generate the page: 0.87745 seconds