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

List:       kde-commits
Subject:    Re: kdelibs/kutils
From:       Aaron Seigo <aseigo () kde ! org>
Date:       2004-12-08 0:42:29
Message-ID: 200412071742.34786.aseigo () kde ! org
[Download RAW message or body]


On December 7, 2004 17:01, George Staikos wrote:
> On Tuesday 07 December 2004 18:44, Aaron J. Seigo wrote:
> > CVS commit by aseigo:
> >
> > don't give me seizures and don't lock up kicker with masterflash style
> > dance moves
> >
> >   M +4 -1      kcmoduleproxy.cpp   1.5
> > +
> > const_cast<KCModuleProxy*>(this)->setMinimumSize(d->view->size());
>
>   Ughhh  design flaw in the class?

maybe; this code is pretty snaky and i don't pretend to understand it 
completely...

anyways, this const cast is due to this:

*       /* This is all we do for now; all the heavy work is*
*        * done in realModule(). It's called when the module
*        * _actually_ is needed, in for example showEvent().
*        * The module is loaded "on demand" -- lazy loading.
*        */

due to this, realModule() can be called for the first time from a const 
method, and there is no saying which method will be called first. in 
KCMultiDialog it's KCModuleProxy::buttons(), and buttons() is const.

so even wrapping the "if we have a module return it" bits in a method of its 
own won't work since the const methods are the ones that actually trigger 
creation. (i actually have a patch that does this and it leads to 
unsuccessful loading of the module =/ )

the rest of the const violations are hidden because ALL the data members of 
this class are in the private class. this nicely masks such problems since in 
const methods you aren't changing const members, but non-const members of a 
const member. bleh.

not really a big issue all in all .. just not as pretty as it could be.

-- 
Aaron J. Seigo
Society is Geometric

[Attachment #3 (application/pgp-signature)]

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

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