[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-core-devel
Subject: Re: kaction destructors
From: Simon Hausmann <shaus () helios ! med ! Uni-Magdeburg ! DE>
Date: 2000-05-16 9:24:17
[Download RAW message or body]
On Tue, 16 May 2000, David Faure wrote:
> I never really like too intelligent destructors.
> Reminds of ~KSpreadCell, culprit number one for kspread crashes ;-)
Ohh, hehe ;) that's a good example ;-)
> In fact I think it's ok to have a destructor do something if it undoes
> what the constructor did - which is not the case here... but not far
> from it. We undo the 'plug' done with this action. Why not...
Hmmm, you have a good point here (design)
> What happens if the containers are destructed first ?
> This is possible, right ? In this case we don't want to unplug all actions
> one by one (and especially not to call methods on a destructed object), but
> we just want to get rid of everything - and in this case any smart code
> in the destructors simply slows down everything.
Hmm, deleting/destructing containers shouldn't destroy the action
objects IMHO. And KAction makes use of the destroyed() signal to find out
when a container is destroyed, so this is no problem I think.
Hmmmm, ok, you convinced me :-) . Let's keep things as they are and tell
the developers to take care of unplugging actions from all containers
before destroying them.
> PS: I'm not concerned with possible code duplication here (a loop and a call
> shouldn't be much code).
Ok :)
Bye,
Simon
> On Tue, May 16, 2000 at 10:14:47AM +0200, Simon Hausmann wrote:
> > Hi,
> >
> > I'd like to simplify the usages of the action classes a bit, in particular
> > the destruction.
> >
> > When destructing an action object, you currently have to make sure to
> > unplug it from all plugged containers. Lazy hackers (like me :-) tend to
> > forget that, which can easily lead to ugly bugs (like bookmark menu
> > crashes in konqueror) .
> >
> > I think we could solve this by duplicating a bit of code (/me ducks :-) in
> > all the action destructors (a loop to iterate over all containers and call
> > the virtual unplug method on them) ).
> >
> > What do you think? Does that make sense?
> >
> > Any idea how to avoid the code duplication? (/me looks at David :-)
> >
> > Bye,
> > Simon
>
> --
> David FAURE
> david@mandrakesoft.com, faure@kde.org
> http://home.clara.net/faure/
> KDE, Making The Future of Computing Available Today
>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic