[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-perl
Subject:    Re: [Kde-perl] Smokin'
From:       Ashley Winters <qaqortog () nwlink ! com>
Date:       2002-06-12 10:12:05
[Download RAW message or body]

On Wednesday 12 June 2002 09:20 am, David Faure wrote:
> Hi Ashley,
>
> sorry for the slightly longer delay than usual, I was in Germany ;)

No problem, just remember to give a "wow" or something at Germain's code. :)

> > I don't know how I lasted so long without a flags field in Smoke::Class.
> > I need to know what classes have overridden virtual destructors, so I
> > know when to expect destructor callbacks. Currently, I use isa("QObject")
> > || isa("QPaintDevice"). I would also like to know which classes have copy
> > constructors. I'll probably use another flag to mark classes which are
> > listed but not defined (like QWidget would be in SmokeKDE).
> >
> > David, can you add a flags field to smoke.h whenever Kalyptus generates
> > it?
> >
> > +    enum ClassFlags {
> > +	cf_constructor = 0x01,	// has constructor
> > +	cf_deepcopy = 0x02,	// has copy constructor
> > +	cf_virtual = 0x04,	// has virtual destructor
> > +	cf_undefined = 0x10	// defined elsewhere
> > +    };
>
> Done. I made kalyptus set the cf_constructor and cf_deepcopy flags, from
> {CanBeInstanciated} and {CanBeCopied} ones.
> What is cf_virtual good for? For sure I got rid of it in kalyptus itself,
> which means the generated code doesn't depend on whether there are
> virtual methods or not (or specifically a virtual dtor). But I don't have
> the full picture, if you say you need it I can easily add it ;)

I need to know when I'll get a callback on object destruction. If Qt deletes 
an object PerlQt created without a virtual destructor, I'll never know about 
it.

There are two reasons. First, I have at least one global data structure which 
grows when (virtual) objects are created, the pointer => object map. When 
pointers are deleted, I need to delete the mappings or face a memory leak. 
Second, if I don't know whether an object is already deleted by Qt, I might 
delete it again.

Like I said above, I currently *guess* whether an object has a virtual 
destructor depending on what class it inherits. I'd like it to be more 
general than that. Perhaps knowing that QEvent has a virtual destructor will 
come in handy someday. *shrug*

Ashley Winters

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic