EBN const-ref fixes

Harri Porten porten at froglogic.com
Sat Apr 28 11:54:19 BST 2007


On Thu, 26 Apr 2007, Alex Merry wrote:

> Are these const-ref return fixes in kdelibs/kdecore OK to commit (on
> Monday, of course)?

Have you doubled-check potential side effects of this one (and the 2nd 
occurrence of the same statement):

--- config/ksharedconfig.cpp    (revision 658327)
+++ config/ksharedconfig.cpp    (working copy)
@@ -78,7 +78,7 @@ KSharedConfigPtr::~KSharedConfigPtr()
              delete d;
          } else if (d->ref == 1 && d->componentData().isValid()) {
              // it might be KComponentData holding the last ref
- 
const_cast<KComponentData&>(d->componentData())._checkConfig();
+            d->componentData()._checkConfig();

The _checkConfig() might now happen on a temporary copy rather than on the 
original instance. Depends on the semantics of the class and function, 
though.

Harri.




More information about the kde-core-devel mailing list