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

Home » Public Forums » archive » Re: Where is the trick in objects
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: Where is the trick in objects [message #34628 is a reply to message #34623] Thu, 10 April 2003 01:30 Go to previous messageGo to previous message
Thomas Gutzler is currently offline  Thomas Gutzler
Messages: 44
Registered: November 2002
Member
David Fanning wrote:
> Thomas Gutzler (tgutzler@ee.uwa.edu.au) writes:
>
>
>> I think I ran into a little problem while trying to program my own
>> object. I can create it, work with it, and destroy it. But I can't get
>> rid of uncleared heap variables.
>> I tried a ::KILL method which uses 'heap_free, self' or ptr_free and
>> obj_delete on several self.variables and self.objects.
>> obj_destroy, myobject doesn't work, too.
>>
>> I'm kind of clueless.
>
>
> Oh, dear. Someone needs to write a book on this subject. :-(

Yeah, I'll do that later :)

>> My object generates a base widget and some dependent widgets (draw, ..),
>> views an image and a polyline and modifies this image. I think, closing
>> the base widget without a cleanup-function causes the leak, but PsConfig
>> doesn't have a cleanup, too :/
>
>
> I didn't see a CLEANUP method, but you certainly need one.
> I would name your KILL method CLEANUP. The CLEANUP method
> will be called automatically when the object is destroyed.

That one was pretty helpfull.

> The problem you are trying to solve with your ALL structure
> is that you are trying to do something in an event handler
> procedure that really wants to be done in an event handler
> *method*. This is the problem I alluded to earlier today:
> How do you combine widget functionality with object methodology?
>
> The easiest way to do this is store the object reference (self)
> in the UVALUE of the top-level base. Then make all your events
> go to an event handler procedure like this:
>
> PRO OBJECT_EVENT_DISPATCHER, event
> Widget_Control, event.top, Get_UValue=theObject
> theObject -> EVENT_HANDLER, event
> END

And this was even more helpfull!

IDL> a = OBJ_new('GUI_CC', array) & a->gui
(... work with the gui ...)
IDL> obj_destroy, a
IDL> help, /heap
Heap Variables:
# Pointer: 0
# Object : 0

Thanks a lot - again - David.

lucky,
Tom
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Re: Proper pointer cleanup question
Next Topic: Re: porting IDL code to OS X

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

Current Time: Fri Oct 10 20:51:31 PDT 2025

Total time taken to generate the page: 0.40297 seconds